1
1
mirror of https://github.com/mrabarnett/mrab-regex.git synced 2025-10-05 20:02:39 +02:00

Git issue 495: Running time for failing fullmatch increases rapidly with input length

Re-enabled modified repeat guards due to regression in speed caused by excessive backtracking.
This commit is contained in:
Matthew Barnett
2023-03-23 17:37:37 +00:00
parent 5954c51580
commit 15cbd1eaf3
3 changed files with 7 additions and 4 deletions

View File

@@ -23178,7 +23178,10 @@ Py_LOCAL_INLINE(RE_STATUS_T) add_repeat_guards(PatternObject* pattern, RE_Node*
RE_STATUS_REF);
repeat_info = &pattern->repeat_info[node->values[0]];
repeat_info->status |= RE_STATUS_BODY;
/* Removing guard here to fix issue 494 and prevent
* regression of issue 495.
*/
/* repeat_info->status |= RE_STATUS_BODY; */
if (tail_result != RE_STATUS_REF)
repeat_info->status |= RE_STATUS_TAIL;
@@ -23639,7 +23642,7 @@ Py_LOCAL_INLINE(BOOL) optimise_pattern(PatternObject* pattern) {
/* Add position guards for repeat bodies containing a reference to a group
* or repeat tails followed at some point by a reference to a group.
*/
//add_repeat_guards(pattern, pattern->start_node);
add_repeat_guards(pattern, pattern->start_node);
/* Record the index of repeats and fuzzy sections within the body of atomic
* and lookaround nodes.

View File

@@ -241,7 +241,7 @@ __all__ = ["cache_all", "compile", "DEFAULT_VERSION", "escape", "findall",
"VERSION1", "X", "VERBOSE", "W", "WORD", "error", "Regex", "__version__",
"__doc__", "RegexFlag"]
__version__ = "2.5.124"
__version__ = "2.5.125"
# --------------------------------------------------------------------
# Public interface.

View File

@@ -7,7 +7,7 @@ with open('README.rst') as file:
setup(
name='regex',
version='2023.3.22',
version='2023.3.23',
description='Alternative regular expression module, to replace re.',
long_description=long_description,
long_description_content_type='text/x-rst',