view src/testdir/bench_re_freeze.vim @ 14897:0c845463a0db v8.1.0460

patch 8.1.0460: assert_fails() does not take a message argument commit https://github.com/vim/vim/commit/1307d1c003b01b4f67524c95feb07c3d91c7c428 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Oct 7 20:16:49 2018 +0200 patch 8.1.0460: assert_fails() does not take a message argument Problem: assert_fails() does not take a message argument Solution: Add the argument.
author Bram Moolenaar <Bram@vim.org>
date Sun, 07 Oct 2018 20:30:06 +0200
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