view src/testdir/bench_re_freeze.vim @ 15077:cd6daebf47ae v8.1.0549

patch 8.1.0549: netbeans test depends on README.txt contents commit https://github.com/vim/vim/commit/10efcd5b0259659cd9a152a7a342deb5d56a8eb5 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Nov 26 21:22:07 2018 +0100 patch 8.1.0549: netbeans test depends on README.txt contents Problem: Netbeans test depends on README.txt contents. Solution: Use a generated file instead.
author Bram Moolenaar <Bram@vim.org>
date Mon, 26 Nov 2018 21:30:08 +0100
parents adfbffe1e642
children
line wrap: on
line source

"Test for benchmarking the RE engine

so small.vim
if !has("reltime") | finish | endif
func! Measure(file, pattern, arg)
	for re in range(3)
	    let sstart=reltime()
	    let cmd=printf("../vim -u NONE -N --cmd ':set re=%d'".
		\ " -c 'call search(\"%s\", \"\", \"\", 10000)' -c ':q!' %s", re, escape(a:pattern, '\\'), empty(a:arg) ? '' : a:arg)
	    call system(cmd. ' '. a:file)
	    $put =printf('file: %s, re: %d, time: %s', a:file, re, reltimestr(reltime(sstart)))
	endfor
endfunc