1
0
forked from aniani/vim

patch 9.1.0409: too many strlen() calls in the regexp engine

Problem:  too many strlen() calls in the regexp engine
Solution: refactor code to retrieve strlen differently, make use
          of bsearch() for getting the character class
          (John Marriott)

closes: #14648

Signed-off-by: John Marriott <basilisk@internode.on.net>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
John Marriott
2024-05-12 00:07:17 +02:00
committed by Christian Brabandt
parent 86f6e2c2ee
commit 82792db631
4 changed files with 308 additions and 148 deletions

View File

@@ -5387,7 +5387,7 @@ recursive_regmatch(
rex.input = rex.line;
}
else
rex.input = rex.line + STRLEN(rex.line);
rex.input = rex.line + reg_getline_len(rex.lnum);
}
if ((int)(rex.input - rex.line) >= state->val)
{
@@ -6937,8 +6937,7 @@ nfa_regmatch(
{
colnr_T pos_col = pos->lnum == rex.lnum + rex.reg_firstlnum
&& pos->col == MAXCOL
? (colnr_T)STRLEN(reg_getline(
pos->lnum - rex.reg_firstlnum))
? reg_getline_len(pos->lnum - rex.reg_firstlnum)
: pos->col;
result = (pos->lnum == rex.lnum + rex.reg_firstlnum