Unfortunately this patch works badly when entering new lines before matched paren: consequent new lines show artifacts and matched pair does not change if cursor moved.
среда, 28 мая 2014 г., 1:40:26 UTC+4 пользователь Alexey Radkov написал: > Hi all. > > My home computer is > > Linux 3.14.4-200.fc20.x86_64 x86_64 x86_64 x86_64 GNU/Linux > > running on > > AMD Athlon(tm) 64 X2 Dual Core Processor 5200+ > > Relatively old. And matchparen (I use matchparen++ but they do not differ a > lot) may perform extremely slow in some cases. I found that most slow call in > the plugin is 3match and tried to increase its performance in the attached > patch. > > The idea of the patch: > > Functions match_add() and match_delete() redraw whole screen passing flag > SOME_VALID to redraw_later(). However matchparen does not require that all > screen must be redrawn: the positions of matching pairs are well known and > they are passed in the pattern regexp like \(\%24l\%31c\)\|\(\%28l\%36c\), so > they can be easily retrieved in the match_add()/_delete(). Another fact that > hints that we are dealing with matchparen is id 3 (:3match is mostly solely > used for matchparen as the vim doc says). Now we can calculate boundaries for > redrawing area, set wp->w_buffer->b_mod_set and corresponding top and bottom > lines numbers and finally pass VALID to redraw_later() and it should redraw > only between the top and the bottom lines. > > The patch works best for specific cases: > > when matching pairs are located on the same line or close lines and terminal > area is big enough (this shows best difference due to small redraw area to > the whole terminal area large relation value). > > I am not sure if this patch is clean (especially when using > wp->w_buffer->b_mod... variables). > > I also attached video that shows how vim compiled with this patch (vim.fast) > faster than original vim (vim.slow) (there are two sessions on the video: the > first is slow, the second is fast(er)). > > Cheers, Alexey. -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
