Created
February 15, 2016 09:50
-
-
Save machakann/711c4c70c758731b807c to your computer and use it in GitHub Desktop.
vim-jp/issues #822
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function! Tic() | |
let s:starttime = reltime() | |
endfunction | |
function! Toc() | |
return reltimestr(reltime(s:starttime)) | |
endfunction | |
command! -nargs=0 Tic call Tic() | |
command! -nargs=0 Toc echomsg Toc() | |
function! Profile_matchfuncs() abort | |
let str = '' | |
for c in split('abcdefghijklmno', '\zs') | |
let str .= repeat(c, 1000) | |
endfor | |
let pattern = 'noo' | |
echomsg '*** matchstr, match, matchend ***' | |
Tic | |
for i in range(1, 1000) | |
let result = [matchstr(str, pattern), match(str, pattern), matchend(str, pattern)] | |
endfor | |
Toc | |
echomsg '*** match, matchend (without packing to a list) ***' | |
Tic | |
for i in range(1, 1000) | |
let result1 = match(str, pattern) | |
let result2 = matchend(str, pattern) | |
endfor | |
Toc | |
echomsg '*** matchstrpos ***' | |
Tic | |
for i in range(1, 1000) | |
let result = matchstrpos(str, pattern) | |
endfor | |
Toc | |
endfunction | |
call Profile_matchfuncs() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment