function! Test()
call cursor(1, 1)
let t = reltime()
for i in range(1, line('$'))
call cursor(i, 1)
redraw
endfor
echom reltimestr(reltime(t))
endfunction
function! SetBuf()
for _ in range(1, 100)
call append('$', 'a, b, c, d, e, f, g, h, i, j, k, l = nil')
endfor
let g:ruby_hl_lvar_hl_group = 'Error'
set rtp+=~/.vim/bundle/ruby_hl_lvar.vim/
filetype plugin indent on
syntax enable
endfunction
call SetBuf()
Save the above as test.vim, and run the following command.
vim -u test.vim -N -c 'set ft=ruby' -c 'call Test()'
Before patch(ef2b4a2486d1f84e5e056ac302551afa66c2f5d6)
This patch improves performance by using
matchaddpos()
function, which is available Vim 7.4.330 or later, if available. http://vim-jp.org/vimmagazine/2014/06/30/vimmagazine.htmlmatchaddpos()
is significantly faster thanmatchadd()
. https://github.com/vim/vim/blob/master/runtime/doc/eval.txt#L4442 Vim is particularly faster when moving the cursor.benchmark
Save the above as
test.vim
, and run the following command.Before patch(ef2b4a2486d1f84e5e056ac302551afa66c2f5d6)
1.492471 sec
After patch
0.095837 sec