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

Cache parsed library results. #1307

Merged
merged 1 commit into from
Apr 3, 2024
Merged

Conversation

davidmorgan
Copy link
Collaborator

Benchmarking for #1304 shows that a lot of time is spent getting "ParsedLibraryResults", i.e. parsing files to get syntax trees.

Currently the parsing can be done multiple times per file because the results are not kept. In particular if there are N built_value classes in one file then it will be parsed at least N times.

So, cache the results within one generation.

Add a benchmark to presubmit that creates a simple file with 2500 built_value classes and builds it. Before this change it takes about 1m22s, after it takes about 25s, i.e. it's about 3.4x faster.

Copy link
Contributor

@iinozemtsev iinozemtsev left a comment

Choose a reason for hiding this comment

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

LG

@davidmorgan davidmorgan merged commit ac1883c into google:master Apr 3, 2024
3 checks passed
@davidmorgan davidmorgan deleted the cache-ast branch April 3, 2024 12:26
@davidmorgan
Copy link
Collaborator Author

Thanks :)

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.

2 participants