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

fix(@jsii/spec): speed up assembly validation by 20x for large libraries #3565

Merged
merged 1 commit into from
May 31, 2022

Conversation

Chriscbr
Copy link
Contributor

@Chriscbr Chriscbr commented May 27, 2022

Switch from jsonschema to ajv to improve assembly validation performance.

Previously, loading the type system for aws-cdk-lib and constructs (combined) took around 15-17 seconds on my local development machine, using node v16.8.0. When I ran it with the updated version of @jsii/spec, it only took 750-800ms.

Both ajv and jsonschema are popular npm libraries (we also currently leverage it in the cdk8s-cli). ajv has one downside which is that introduces has a larger bundle size (1.02 MB vs 81.8kB), but I think it's worth it for the performance improvement.

Closes cdklabs/decdk#7


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 May 27, 2022
@Chriscbr Chriscbr changed the title fix: speed up assembly validation by 20x for large libraries fix(@jsii/spec): speed up assembly validation by 20x for large libraries May 27, 2022
@yuth
Copy link
Contributor

yuth commented May 27, 2022

🤯

@Chriscbr Chriscbr merged commit c40f26c into main May 31, 2022
@Chriscbr Chriscbr deleted the rybickic/fast-validation branch May 31, 2022 15:28
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.

Performance issues in decdk renderFullSchema
2 participants