Closed blueyed closed 9 years ago
Nice find! I didn't realize that silent! doautocmd ...
could be so slow.
Thanks! That fixed it.
It seems like this might be a problem in Vim and should get optimized there, too?
Grepping my Vim plugins it appears to be a common practice.
Yeah, it's strange. I don't understand why doautocmd
in this very context is so slow. The above commit circumvents the problem by not doing it when it's not needed, but if you indeed have some action to perform on ObliqueRepeat
(e.g. autocmd User ObliqueRepeat normal! zz
) you'll still notice the enormous slowdown.
Looking at Vim's source the problem is likely the modelines that get applied over and over again.
https://github.com/vim-jp/vim/blob/local/src/ex_docmd.c#L5093-5102
(# vim: ft=dircolors:fdm=marker:et:sw=2:
)
This can be disabled using <nomodeline>
(:do[autocmd] [<nomodeline>] [group] {event} [fname]
).
As for Vim I think an optimization would be to skip this if there are no events defined / executed.
I've proposed this performance improvement on the mailing list:https://groups.google.com/forum/#!topic/vim_dev/DidKMDAsppw
Solid investigation, thanks :+1:
I'll also consider using <nomodeline>
if it's available.
With some syntax files the remapped
n
method appears to be noticeably slower than the default.TEST CASE:
/38<cr>
n
multiple (10) timesProfiling Vim reveals this:
vim-oblique appears to trigger expensive parts in the dircolors syntax handling.