Skip to content

Use pinned gzip for localization generation - #63961

Open
Jake Bailey (jakebailey) wants to merge 4 commits into
microsoft:mainfrom
jakebailey:deterministic-localization-compression
Open

Use pinned gzip for localization generation#63961
Jake Bailey (jakebailey) wants to merge 4 commits into
microsoft:mainfrom
jakebailey:deterministic-localization-compression

Conversation

@jakebailey

@jakebailey Jake Bailey (jakebailey) commented Aug 23, 2026

Copy link
Copy Markdown
Member

Go 1.27 got a new faster gzip implementation. But, its outputs were not stable, so go generate changes 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.

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%).
Copilot AI balanced review requested due to automatic review settings August 23, 2026 00:09
@github-project-automation github-project-automation Bot moved this to Not started in PR Backlog Aug 23, 2026
@typescript-automation typescript-automation Bot added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Aug 23, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Pins localization compression and deduplicates diagnostic keys to ensure reproducible generation while reducing binary size.

Changes:

  • Uses pinned klauspost/compress gzip 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

Status: Not started

Development

Successfully merging this pull request may close these issues.

2 participants