From 619838f85da24d692221ba7cc310d6839ebbe2a5 Mon Sep 17 00:00:00 2001 From: KillTheMule Date: Mon, 3 Jul 2017 09:36:43 +0200 Subject: inccommand: improve performance #6949 During a preview, we can stop looking for matches after we got enough lines for the preview buffer. Because of this perf improvement, the 'redrawtime' test needs to be slowed down in a different way: _long_ lines instead of just many lines. --- src/nvim/ex_cmds.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index 8dcb3ac449..b550e9a9c6 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -3332,7 +3332,8 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout) // Check for a match on each line. linenr_T line2 = eap->line2; for (linenr_T lnum = eap->line1; - lnum <= line2 && !(got_quit || aborting()); + lnum <= line2 && !(got_quit || aborting()) + && (!preview || matched_lines.size <= (size_t)p_cwh); lnum++) { long nmatch = vim_regexec_multi(®match, curwin, curbuf, lnum, (colnr_T)0, NULL); -- cgit