From d3bb177f1e1dcbc4104d7bba6f2ac4ebe3ffc9c9 Mon Sep 17 00:00:00 2001 From: David Bürgin <676c7473@gmail.com> Date: Sat, 28 Mar 2015 22:28:37 +0100 Subject: vim-patch:7.4.497 #2295 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) https://github.com/vim/vim/releases/tag/v7-4-497 Helped-by: David Bürgin <676c7473@gmail.com> Helped-by: Justin M. Keyes Helped-by: Scott Prager --- test/benchmark/bench_re_freeze_spec.lua | 67 +++++++++++++++++++++++++++++++++ test/benchmark/preload.lua | 4 ++ test/benchmark/samples/re.freeze.txt | 6 +++ 3 files changed, 77 insertions(+) create mode 100644 test/benchmark/bench_re_freeze_spec.lua create mode 100644 test/benchmark/preload.lua create mode 100644 test/benchmark/samples/re.freeze.txt (limited to 'test') diff --git a/test/benchmark/bench_re_freeze_spec.lua b/test/benchmark/bench_re_freeze_spec.lua new file mode 100644 index 0000000000..7242f43c8e --- /dev/null +++ b/test/benchmark/bench_re_freeze_spec.lua @@ -0,0 +1,67 @@ +-- Test for benchmarking RE engine. + +local helpers = require('test.functional.helpers') +local feed, insert, source = helpers.feed, helpers.insert, helpers.source +local clear, execute, wait = helpers.clear, helpers.execute, helpers.wait + +-- Temporary file for gathering benchmarking results for each regexp engine. +local result_file = 'benchmark.out' +-- Fixture containing an HTML fragment that can make a search appear to freeze. +local sample_file = 'test/benchmark/samples/re.freeze.txt' + +-- Vim script code that does both the work and the benchmarking of that work. +local measure_cmd = + [[call Measure(%d, ']] .. sample_file .. [[', '\s\+\%%#\@55555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555 + -- cgit