revital.vim makes vital.vim a lot faster.
- Execute
:Vitalize --name={plugin-name} {target-dir} [{module} ...]
to embed vital modules if you didn't run :Vitalize yet. See :h :Vitalize & :h Vital-usage. - Execute
:Revitalize {target-dir}
. - Replace vital#of('plugin-name') with vital#{plugin-name}#of().
- The rest of usage is same as :h Vital-usage.
- Enjoy speed!
Replace {pluginname}
with your plugin name.
:cd $HOME/.vim/bundle/{pluginname}/
:Vitalize --name={pluginname} . Data.List
:Revitalize .
let s:V = vital#{pluginname}#of()
let s:List = s:V.import('Data.List')
echo s:List.uniq([1, 1, 2, 3, 1, 2])
" => [1, 2, 3]
command! -bar TimerStart let start_time = reltime()
command! -bar TimerEnd echo reltimestr(reltime(start_time)) | unlet start_time
function! s:_vital_of() abort
let V = vital#of('incsearch')
call V.load('Data.List')
call V.unload()
endfunction
function! s:_vital_incsearch_of() abort
let V = vital#incsearch#of()
call V.load('Data.List')
call V.unload()
endfunction
let s:times = 100
TimerStart
for _ in range(s:times)
call s:_vital_of()
endfor
TimerEnd
" => 1.565324
TimerStart
for _ in range(s:times)
call s:_vital_incsearch_of()
endfor
TimerEnd
" => 0.028437
vital.vim (x 100) | revital.vim (x 100) |
---|---|
1.565324 sec | 0.028437 sec |
Code is almost same as 1)
.
vital.vim (x 100) | revital.vim (x 100) |
---|---|
1.596271 sec | 0.027732 sec |
Some people claims the plugin using vital.vim is slow, so I guess the speed improvement might be even bigger in some environments.