I try to compare two versions of a same vim function. How can I time them and compare?
What I'm looking for is a simple way to benchmark the first version of the function against the second one, with some kind of precise time echo.
Thank you!
Here is a simple demonstration of the use of :help reltime() and :help reltimestr():
function! Foo()
" do your thing
for i in range(1,8)
let @a = i
endfor
endfunction
" save current time
let start_time = reltime()
" call your function
call Foo()
" echo elapsed time expressed in seconds
echo "elapsed time:" reltimestr(reltime(start_time))
It should output something like:
elapsed time: 0.000165
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With