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

Speed up new backtracking parser #2727

Closed
isidentical opened this issue Dec 26, 2021 · 0 comments · Fixed by #2728
Closed

Speed up new backtracking parser #2727

isidentical opened this issue Dec 26, 2021 · 0 comments · Fixed by #2728
Labels
C: parser How we parse code. Or fail to parse it. C: performance Black is too slow. Or too fast. T: enhancement New feature or request

Comments

@isidentical
Copy link
Collaborator

The current revision of the new backtracking parser (that gets enabled with -t py310) is kind of slow.

For regular inputs that only use match/case without using the pattern matching statements, it is somewhere between 3 to 4 X slower at the moment (going up to 6 or 7 on hand crafted inputs). On some inputs (like Lib/test/test_patma.py) that contain match/case hundreds of times, with new PEP 634 statements, it takes multiple minutes (2 minutes 34 seconds to be exact) to format these.

I don't know if there is any definite way to speed-up these, but I have an idea which I'll post shortly as a draft PR.

@isidentical isidentical added the T: enhancement New feature or request label Dec 26, 2021
@ichard26 ichard26 added C: blib2to3 C: performance Black is too slow. Or too fast. C: parser How we parse code. Or fail to parse it. labels Dec 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: parser How we parse code. Or fail to parse it. C: performance Black is too slow. Or too fast. T: enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants