Skip to content

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

Merged
Chriscbr merged 1 commit intomainfrom
rybickic/fast-validation
May 31, 2022
Merged

fix(@jsii/spec): speed up assembly validation by 20x for large libraries#3565
Chriscbr merged 1 commit intomainfrom
rybickic/fast-validation

Conversation

@Chriscbr
Copy link
Copy Markdown
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.

@Chriscbr Chriscbr requested review from MrArnoldPalmer and yuth May 27, 2022 21:17
@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
Copy Markdown
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