-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
bpo-26415: reduce peak memory consumption by the parser #10995
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
Conversation
This comment has been minimized.
This comment has been minimized.
Pyperformance (0.7.0) reports significant improvement of memory footprint, ranging from "1.03x smaller" to "1.44x smaller", for every benchmark apart from sympy_integrate:
Effects on benchmark times are less substantial, and range from "1.18x faster" for python_startup_no_site, to "1.22x slower" for unpack_sequence. The latter is likely pure noise because the measured times are in nanoseconds range. |
When I leave my machine alone while it's running the benchmarks, the results are even more exciting: all significant differences are in favour of the patched parser, ranging from "1.03x faster" to "1.26x faster".
|
2c88029
to
57a74b7
Compare
I can not believe this affects runtime performance. I tested this PR on my machine (dedicated Linux box).
|
Even if it doesn't, it still affects the memory footprint. Btw, now that @pablogsal has rewritten the parser generator into Python, this patch should be a bit easier to review: the changes to parsermodule.c have reduced from 183 to just 3 LOC. |
Could you use |
Thank you for the suggestion! |
Compress some branchless stretches in the parse tree into a single node. AST is not affected.
@tyomitch, please resolve the merge conflicts. Thank you! |
@tyomitch ping |
Given that we have a new parser in 3.9 and the old parser will be removed in 3.10, this PR is obsolete so I will proceed to close it. Thanks for thinking about this problem, though! |
Compress some branchless stretches in the parse tree into a single node.
AST is not affected.
https://bugs.python.org/issue26415