Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slow greedy regex #112

Open
danielhollas opened this issue May 31, 2021 · 0 comments
Open

Slow greedy regex #112

danielhollas opened this issue May 31, 2021 · 0 comments

Comments

@danielhollas
Copy link

Greedily matching numbers in F90_CONSTANTS_TYPES_RE is super slow for numbers with many digits.

https:/pseewald/fprettify/blob/cb254022c2034ad3b8f744f4dad1bf5b7438815d/fprettify/__init__.py#L475

Kudos to @Jellby and @zaikunzhang for independently discovering this and fixing it as part of their PRs in
https:/pseewald/fprettify/pull/99/commits/2f766f33ed795ee69d0ac404e699e5475ff52f3f and https:/pseewald/fprettify/pull/106/commits/bf41457c782997e378144297e764092d09a3fa5f, respectively.

Since those PRs are not yet merged, I am documenting the issue here for clarity. As one data point, parsing one file with 600 lines containing a lot of numbers went from 12s to 1s after the fix!

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

No branches or pull requests

1 participant