view src/testdir/bench_re_freeze.vim @ 13134:c4b5ad2b3596 v8.0.1441

patch 8.0.1441: using ":undo 0" leaves undo in wrong state commit https://github.com/vim/vim/commit/ce46d934af35d0f774be7f996001db03cf0b894a Author: Bram Moolenaar <Bram@vim.org> Date: Tue Jan 30 22:46:06 2018 +0100 patch 8.0.1441: using ":undo 0" leaves undo in wrong state Problem: Using ":undo 0" leaves undo in wrong state. Solution: Instead of searching for state 1 and go above, just use the start. (Ozaki Kiichi, closes #2595)
author Christian Brabandt <cb@256bit.org>
date Tue, 30 Jan 2018 23:00:06 +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