view src/testdir/bench_re_freeze.vim @ 15860:9cd9bf2897de v8.1.0937

patch 8.1.0937: invalid memory access in search pattern commit https://github.com/vim/vim/commit/f1b57ab2ab18032d19f64bff7d22f3adb3fe93f7 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Feb 17 13:53:34 2019 +0100 patch 8.1.0937: invalid memory access in search pattern Problem: Invalid memory access in search pattern. (Kuang-che Wu) Solution: Check for incomplete collation element. (Dominique Pelle, closes #3985)
author Bram Moolenaar <Bram@vim.org>
date Sun, 17 Feb 2019 14: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