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

feat(jsii-reflect): TypeSystem can be locked to improve reflection performance #4318

Merged
merged 1 commit into from
Nov 8, 2023

Conversation

mrgrain
Copy link
Contributor

@mrgrain mrgrain commented Nov 7, 2023

Memoizes additional calls that rely on the typesystem to retrieve type instances.
These calls can (theoretically) change when the typesystem is changed.
Therefore we cannot assume it's okay to always memoize the first call.

To workaround this limitation, we introduce a new mechanism to manually lock the typesystem once all assemblies are loaded.
We then can start memoizing the additional calls.

For example in awslint this reduces the runtime against aws-cdk-lib by ~20s.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Nov 7, 2023
@mrgrain mrgrain force-pushed the mrgrain/fix/memoize-ancestor-calls branch from 98a420b to 0073c3e Compare November 7, 2023 13:30
@mrgrain mrgrain marked this pull request as draft November 7, 2023 13:58
@mrgrain mrgrain changed the title fix(jsii-reflect): getAncestors takes a long time feat(jsii-reflect): TypeSystem can be locked to improve reflection performance Nov 8, 2023
…rformance

Memoizes additional calls when the typesystem has been locked.
@mrgrain mrgrain force-pushed the mrgrain/fix/memoize-ancestor-calls branch from 0073c3e to ca03d97 Compare November 8, 2023 11:44
@mrgrain mrgrain marked this pull request as ready for review November 8, 2023 12:07
Copy link
Contributor

mergify bot commented Nov 8, 2023

Thank you for contributing! ❤️ I will now look into making sure the PR is up-to-date, then proceed to try and merge it!

@mergify mergify bot added the pr/ready-to-merge This PR is ready to be merged. label Nov 8, 2023
Copy link
Contributor

mergify bot commented Nov 8, 2023

Merging (with squash)...

@mergify mergify bot merged commit c87da43 into main Nov 8, 2023
37 checks passed
@mergify mergify bot deleted the mrgrain/fix/memoize-ancestor-calls branch November 8, 2023 13:58
@mergify mergify bot removed the pr/ready-to-merge This PR is ready to be merged. label Nov 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution/core This is a PR that came from AWS.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants