Use pinned gzip for localization generation - #63961
Open
Jake Bailey (jakebailey) wants to merge 4 commits into
Open
Use pinned gzip for localization generation#63961Jake Bailey (jakebailey) wants to merge 4 commits into
Jake Bailey (jakebailey) wants to merge 4 commits into
Conversation
Pin localization compression to klauspost/compress and use a canonical gzip timestamp. Locale .gz files: 1,093,591 -> 1,080,264 bytes (-13,327; -1.22%). Release tsc binary: 24,613,024 -> 24,600,736 bytes (-12,288; -0.05%).
Store the shared diagnostic key table once and encode each locale as a positional array guarded by an XXH3-128 fingerprint. Locale .gz files: 1,080,264 -> 529,777 bytes (-550,487; -50.96%). Release tsc binary: 24,600,736 -> 24,080,544 bytes (-520,192; -2.11%).
Contributor
There was a problem hiding this comment.
Pull request overview
Pins localization compression and deduplicates diagnostic keys to ensure reproducible generation while reducing binary size.
Changes:
- Uses pinned
klauspost/compressgzip generation. - Stores shared locale keys once with hash validation.
- Tests loading every embedded locale.
Reviewed changes
Copilot reviewed 4 out of 19 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
tsc/internal/diagnostics/loc_generated.go |
Adds shared key table and array-based locale decoding. |
tsc/internal/diagnostics/generate.go |
Generates deterministic compressed locale arrays. |
tsc/internal/diagnostics/generate_deps.go |
Preserves generator dependency during module cleanup. |
tsc/internal/diagnostics/diagnostics_test.go |
Verifies every locale loads successfully. |
tsc/go.mod |
Adds the pinned compression dependency. |
tsc/go.sum |
Records dependency checksums. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
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.
Go 1.27 got a new faster gzip implementation. But, its outputs were not stable, so
go generatechanges depending on the toolchain.Instead, generate the files with
github.com/klauspost/compress, which is then a pinned dep.While here, change the way we store the data to not duplicate diagnostic keys between locales.
These two changes together reduce our binary size by about 0.53MB.