Skip to content

Attempt to speed up deepfreeze.py #107887

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

Merged
merged 4 commits into from
Aug 14, 2023
Merged

Conversation

gvanrossum
Copy link
Member

@gvanrossum gvanrossum commented Aug 11, 2023

  • Instead of calling get_identifiers_and_strings(), extract identifiers and strings from pycore_global_strings.h.
  • Avoid ast.literal_eval(), which speeds up decode_frozen_data() tremendously.

On my Mac, the first commit cuts the time to run deepfreeze.py in half, from 9 to 4.5 seconds, and the second and third commits cut more than halve it again, to 1.8 seconds.

I verified that the output is the same.

Instead of calling get_identifiers_and_strings(),
extract identifiers and strings from pycore_global_strings.h.
@kumaraditya303
Copy link
Contributor

Not much of a difference on my machine, it goes from 2.4 sec to 2 sec but speedup seems worth it for Mac.

@Eclips4 Eclips4 added performance Performance or resource usage build The build process and cross-build and removed performance Performance or resource usage labels Aug 12, 2023
Copy link
Member

@AA-Turner AA-Turner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two minor suggestions

@gvanrossum
Copy link
Member Author

I'd like to merge this some time Monday.

@gvanrossum gvanrossum merged commit a2a4b9f into python:main Aug 14, 2023
@gvanrossum gvanrossum deleted the faster-deepfreeze branch August 14, 2023 21:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build The build process and cross-build skip issue skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants