view src/testdir/bench_re_freeze.vim @ 17391:8a43873df941 v8.1.1694

patch 8.1.1694: the RUN_VIM variable is longer than needed commit https://github.com/vim/vim/commit/41a82604453080d0011f281532582d3bd360df4a Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jul 14 21:54:26 2019 +0200 patch 8.1.1694: the RUN_VIM variable is longer than needed Problem: The RUN_VIM variable is longer than needed. Solution: Shorten RUN_VIM. (Daniel Hahler, closes https://github.com/vim/vim/issues/4643)
author Bram Moolenaar <Bram@vim.org>
date Sun, 14 Jul 2019 22:00:05 +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