Add canonical pipeline benchmark and optimize hot paths#2946
Merged
Conversation
schani
marked this pull request as ready for review
July 14, 2026 21:04
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
onTimingcallbackRoot causes and optimizations
The Rust renderer's naming pass repeatedly rebuilt identical forbidden-name unions and rescanned namespaces that were already complete. This was especially expensive because Rust checks its global keyword namespace for properties, enum cases, and union members.
Large inferred JSON inputs also accumulated millions of redundant empty attribute entries and allocated a
StringTypesobject/map/set per observed string. Large JSON schemas were being parsed through the YAML lexer even when they were strict JSON.This change:
JSON.parsebefore retaining YAML as a compatibility fallbackCanonical results
Node 24.6.0, macOS arm64, three measured runs and one warmup per case:
The sum of the ten medians is 42.5% lower. Every case is faster and every measured maximum heap value is lower.
All ten generated canonical outputs were compared against an unoptimized build and matched byte-for-byte by SHA-256.
Validation
npm run build --workspace quicktype-corenpm run test:unit— 20 files, 136 testsnpm run lintQUICKTEST=true FIXTURE=typescript npm run test:fixtures— 70 testsThe external Rust fixture compiler was not run because
cargois unavailable in this environment; Rust generation is covered by unit tests, the canonical runs, and output identity checks.