-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use a timeout of 5s for searchpairpos #90
Conversation
The timeout is supported with Vim 7.3.429 at least. In case of issues (breaking older Vims), this could be wrapped to fallback to some (higher) max offset. Fixes #64.
Manual testing: it takes 15 seconds to re-indent a flat list iteral with 1000 items (one per line). Indenting just a single line at the end of the list feels instant. A more complicated 273-line nested dict literal took 38 seconds to indent. It's very noticeable how the first few blocks of 50 lines go fast and the last ones are very slow. Quadratic behavior, I suppose. Hitting For the use case of reindenting a whole block I would prefer slow but correct behavior. For the use case of just appending one line as I type, I'd prefer fast (up to 0.5s) but wrong. I think a documented setting would be useful: I could increment it temporarily if I discover the need to reindent a large literal I just pasted, after I discover that the default timeout is too short to do it correctly. |
So the timeout is per lookup then, and should be shorter than 5s for sure. Can you provide the 273-line example, so that it could be profiled? Or profile it yourself, using Vim's We can probably detect if it's while typing or indentation ( |
The 1000-item list was synthetic:
The test I did was selecting the block with The JSON blob I'll provide later, when I get to a computer. I performed the same two tests, except I used |
Here's the JSON blob: https://gist.github.com/mgedmin/a32a3b8c188a8cea1204b98e015562f8. (My use case was to paste it into my application code temporarily to stub some data. JSON is practically Python, I just have to change Very curiously, today I cannot reproduce my timings -- indentation is very fast. Even if I reindent the entire 1278-line test file (the synthetic list plus this json blob), it takes just 10 seconds. And I'm pretty sure I didn't do any git pulls in any vim plugins, so I'm not sure what might have changed! I do git pull and rebuild my vim practically every day, but I don't think any optimizations happened recently there either. |
Just a note: the 5s timeout is much too long, especially when it is used "interactively" after e.g. |
The timeout is supported with Vim 7.3.429 at least.
In case of issues (breaking older Vims), this could be wrapped to
fallback to some (higher) max offset.
Fixes #64.
TODO:
Would a (documented) setting for this be useful?
Is 5s a sane default?