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

Optimize field registry population mechanism by parsing each source file only once #230

Merged
merged 7 commits into from
May 15, 2024

Conversation

nimakarimipour
Copy link
Member

@nimakarimipour nimakarimipour commented May 13, 2024

In FieldRegistryPopulation we process a single compilation unit tree multiple times as this method receives a pair of a class flat name and a path to source file containing that class, hence, for compilation unit trees that contains multiple classes, inner classes and anonymous classes we parse the same source file multiple times. This PR updates this mechanism by caching the latest parsed source file. This optimization is according to the assumption that Scanner visits all classes within a single compilation unit tree consecutively.

@nimakarimipour nimakarimipour self-assigned this May 13, 2024
@nimakarimipour nimakarimipour added the enhancement New feature or request label May 13, 2024
@nimakarimipour nimakarimipour changed the title Optimize field registry population Optimize field registry population mechanism by parsing each source file only once May 13, 2024
Copy link
Member

@msridhar msridhar left a comment

Choose a reason for hiding this comment

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

LGTM, just one minor question, does not need to be addressed before landing

} else {
tree = Injector.parse(path);
}
lastParsedSourceFile = new Pair<>(path, tree);
Copy link
Member

Choose a reason for hiding this comment

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

Could this line be inside the preceding else block?

Copy link
Member Author

Choose a reason for hiding this comment

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

@nimakarimipour nimakarimipour merged commit 2229914 into master May 15, 2024
7 checks passed
@nimakarimipour nimakarimipour deleted the nimak/optimize-field-registry-parse branch May 15, 2024 04:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants