Skip to content

Fix quadratic-time linebreak parsing#268

Open
absolutely-vivid wants to merge 1 commit into
frostming:masterfrom
absolutely-vivid:fix-219
Open

Fix quadratic-time linebreak parsing#268
absolutely-vivid wants to merge 1 commit into
frostming:masterfrom
absolutely-vivid:fix-219

Conversation

@absolutely-vivid
Copy link
Copy Markdown
Contributor

This is a quick hack to fix issue #219. The regex pattern used for parsing linebreaks combined with the use of re.finditer runs in quadratic time when the parsing input doesn't contain a newline character. By checking for the presence of a newline character the problematic pattern can be short-circuited. Ideally a proper fix would fix the regex pattern itself, but this is a useful fix to have in place until the pattern is fixed.

Fixes #219

This is a quick hack to fix issue frostming#219. The regex pattern used for parsing
linebreaks combined with the use of `re.finditer` runs in quadratic time
when the parsing input doesn't contain a newline character. By checking
for the presence of a newline character the problematic pattern can be
short-circuited. Ideally a proper fix would fix the regex pattern itself,
but this is a useful fix to have in place until the pattern is fixed.

Fixes frostming#219
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

marko.parse has quadtratic time for some input

1 participant