0
0
mirror of https://github.com/vim/vim.git synced 2025-10-26 09:14:23 -04:00
Files
vim/src/testdir/test_bench_regexp.vim
Christian Brabandt b0905e269d patch 9.1.1524: tests: too many imports in the test suite
Problem:  tests: too many imports in the test suite
Solution: Clean up the imported scripts

Most tests make use of check.vim, so let's just source it once in
runtest.vim instead of having each test manually source it.

runtest.vim already sources shared.vim, which again sources
view_util.vim, so we don't need to source those two common
dependencies in all the other tests

And then check.vim sources term_util.vim already, so we can in addition
drop sourcing it explicitly in each single test script.

Note: test_expand_func.vim had to be updated to account for the changed
number of sourced files.

And finally check.vim uses line-continuation so let's also explicitly
enable line continuation via the 'cpo' option value.

related: #17677

Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-07-07 20:39:29 +02:00

24 lines
688 B
VimL

" Test for benchmarking the RE engine
CheckFeature reltime
func Measure(file, pattern, arg)
for re in range(3)
let sstart = reltime()
let before = ['set re=' .. re]
let after = ['call search("' .. escape(a:pattern, '\\') .. '", "", "", 10000)']
let after += ['quit!']
let args = empty(a:arg) ? '' : a:arg .. ' ' .. a:file
call RunVim(before, after, args)
let s = 'file: ' .. a:file .. ', re: ' .. re ..
\ ', time: ' .. reltimestr(reltime(sstart))
call writefile([s], 'benchmark.out', "a")
endfor
endfunc
func Test_Regex_Benchmark()
call Measure('samples/re.freeze.txt', '\s\+\%#\@<!$', '+5')
endfunc
" vim: shiftwidth=2 sts=2 expandtab