From fda3729a064d6466cec6ac83dd1bfcc437ea4cc9 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 5 Nov 2014 14:27:36 +0100 Subject: updated for version 7.4.497 Problem: With some regexp patterns the NFA engine uses many states and becomes very slow. To the user it looks like Vim freezes. Solution: When the number of states reaches a limit fall back to the old engine. (Christian Brabandt) --- src/testdir/Make_dos.mak | 9 +++++++++ src/testdir/Make_ming.mak | 11 +++++++++++ src/testdir/Make_os2.mak | 11 +++++++++++ src/testdir/Makefile | 15 ++++++++++++++- src/testdir/bench_re_freeze.in | 13 +++++++++++++ src/testdir/bench_re_freeze.vim | 13 +++++++++++++ src/testdir/samples/re.freeze.txt | 6 ++++++ 7 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 src/testdir/bench_re_freeze.in create mode 100644 src/testdir/bench_re_freeze.vim create mode 100644 src/testdir/samples/re.freeze.txt (limited to 'src/testdir') diff --git a/src/testdir/Make_dos.mak b/src/testdir/Make_dos.mak index abcabce03..07c6831f0 100644 --- a/src/testdir/Make_dos.mak +++ b/src/testdir/Make_dos.mak @@ -87,6 +87,7 @@ clean: -if exist Xfind rd /s /q Xfind -if exist viminfo del viminfo -del test.log + -if exists benchmark.out del benchmark.out .in.out: -if exist $*.failed del $*.failed @@ -103,3 +104,11 @@ clean: nolog: -del test.log + +benchmark: + bench_re_freeze.out + +bench_re_freeze.out: bench_re_freeze.vim + -if exist benchmark.out del benchmark.out + $(VIMPROG) -u dos.vim -U NONE --noplugin $*.in + @IF EXIST benchmark.out ( type benchmark.out ) diff --git a/src/testdir/Make_ming.mak b/src/testdir/Make_ming.mak index 2a124b1b8..d2995a50b 100644 --- a/src/testdir/Make_ming.mak +++ b/src/testdir/Make_ming.mak @@ -12,11 +12,13 @@ ifneq (sh.exe, $(SHELL)) DEL = rm -f MV = mv CP = cp +CAT = cat DIRSLASH = / else DEL = del MV = rename CP = copy +CAT = type DIRSLASH = \\ endif @@ -72,6 +74,8 @@ SCRIPTS32 = test50.out test70.out SCRIPTS_GUI = test16.out +SCRIPTS_BENCH = bench_re_freeze.out + .SUFFIXES: .in .out vimall: fixff $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS_GUI) $(SCRIPTS32) @@ -80,6 +84,8 @@ vimall: fixff $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS_GUI) $(SCRIPTS32) nongui: fixff $(SCRIPTS16) $(SCRIPTS) echo ALL DONE +benchmark: $(SCRIPTS_BENCH) + small: echo ALL DONE @@ -114,3 +120,8 @@ clean: -$(DEL) X* -$(DEL) test.ok -$(DEL) viminfo + +bench_re_freeze.out: bench_re_freeze.vim + -$(DEL) benchmark.out + $(VIMPROG) -u dos.vim -U NONE --noplugin $*.in + $(CAT) benchmark.out diff --git a/src/testdir/Make_os2.mak b/src/testdir/Make_os2.mak index 5f3dc1393..3b6b4071d 100644 --- a/src/testdir/Make_os2.mak +++ b/src/testdir/Make_os2.mak @@ -50,6 +50,8 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \ test_signs.out \ test_utf8.out +SCRIPTS_BENCH = bench_re_freeze.out + .SUFFIXES: .in .out all: /tmp $(SCRIPTS) @@ -57,6 +59,8 @@ all: /tmp $(SCRIPTS) $(SCRIPTS): $(VIMPROG) +benchmark: $(SCRIPTS_BENCH) + clean: -rm -rf *.out Xdotest test.ok tiny.vim small.vim mbyte.vim viminfo @@ -75,3 +79,10 @@ clean: # Create a directory for temp files /tmp: -mkdir /tmp + +bench_re_freeze.out: bench_re_freeze.vim + -del $*.failed test.ok benchmark.out + copy $*.ok test.ok + $(VIMPROG) -u os2.vim --noplugin -s dotest.in $*.in + type benchmark.out + diff --git a/src/testdir/Makefile b/src/testdir/Makefile index 6b3bf9b7e..1f5095e55 100644 --- a/src/testdir/Makefile +++ b/src/testdir/Makefile @@ -48,12 +48,16 @@ SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out \ SCRIPTS_GUI = test16.out +SCRIPTS_BENCH = bench_re_freeze.out + .SUFFIXES: .in .out nongui: nolog $(SCRIPTS) report gui: nolog $(SCRIPTS) $(SCRIPTS_GUI) report +benchmark: $(SCRIPTS_BENCH) + report: @echo @echo 'Test results:' @@ -65,7 +69,7 @@ report: $(SCRIPTS) $(SCRIPTS_GUI): $(VIMPROG) RM_ON_RUN = test.out X* viminfo -RM_ON_START = tiny.vim small.vim mbyte.vim mzscheme.vim lua.vim test.ok +RM_ON_START = tiny.vim small.vim mbyte.vim mzscheme.vim lua.vim test.ok benchmark.out RUN_VIM = VIMRUNTIME=$(SCRIPTSOURCE); export VIMRUNTIME; $(VALGRIND) $(VIMPROG) -u unix.vim -U NONE --noplugin -s dotest.in clean: @@ -120,5 +124,14 @@ test49.out: test49.vim test60.out: test60.vim +bench_re_freeze.out: bench_re_freeze.vim + -rm -rf benchmark.out $(RM_ON_RUN) + # Sleep a moment to avoid that the xterm title is messed up. + # 200 msec is sufficient, but only modern sleep supports a fraction of + # a second, fall back to a second if it fails. + @-/bin/sh -c "sleep .2 > /dev/null 2>&1 || sleep 1" + -$(RUN_VIM) $*.in + @/bin/sh -c "if test -f benchmark.out; then cat benchmark.out; fi" + nolog: -rm -f test.log diff --git a/src/testdir/bench_re_freeze.in b/src/testdir/bench_re_freeze.in new file mode 100644 index 000000000..7b1bfa345 --- /dev/null +++ b/src/testdir/bench_re_freeze.in @@ -0,0 +1,13 @@ +Test for Benchmarking RE engine + +STARTTEST +:so small.vim +:if !has("reltime") | qa! | endif +:set nocp cpo&vim +:so bench_re_freeze.vim +:call Measure('samples/re.freeze.txt', '\s\+\%#\@55555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555 + -- cgit v1.2.3