Created
June 15, 2013 06:23
-
-
Save cohama/5787135 to your computer and use it in GitHub Desktop.
This file contains 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
let s:V = vital#of('vital') | |
let s:S = s:V.import('Data.String') | |
let start = reltime() | |
let test1 = s:S.substitute_last(repeat('vim is vital', 1000), 'i', 'ooo') | |
let elapsed = reltimestr(reltime(start)) | |
echo "substitute last" elapsed | |
let start = reltime() | |
let test2 = substitute(repeat('vim is vital', 1000), 'i', 'ooo', '') | |
let elapsed = reltimestr(reltime(start)) | |
echo "substitute first" elapsed | |
let start = reltime() | |
let test3 = substitute(repeat('vim is vital', 1000), '.*\zsi', 'ooo', '') | |
let elapsed = reltimestr(reltime(start)) | |
let verify = (test1 ==# test3) | |
echo "substitute deris" elapsed verify |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
substitute last 2.417154
substitute first 0.000038
substitute deris 0.000844 1