Repository navigation
perf(web): compress the wasm with zstd -19 - #2650
Merged
Merged
Conversation
Laotree
force-pushed
the
feature/web-zstd
branch
2 times, most recently
from
November 27, 2026 11:25
7473720 to
a8ce604
Compare
The gallery and the docs' live app now ship their wasm as a .zst stream at level 19, decoded in the page by zstddec. On the inputs group the stream is 76.9% of the gzip -9 size, and the other groups land at 75.0-76.9%. The page decodes zstd faster than DecompressionStream decodes gzip. nsgo.json names the stream with codec, stream and streamSize in place of gzip and gzipSize. Both loaders still skip decoding when a host has already done it, by looking for the zstd frame magic. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Laotree
force-pushed
the
feature/web-zstd
branch
from
November 27, 2026 11:25
a8ce604 to
e792344
Compare
Contributor
Author
|
Note for whoever lands this: #2644 changes 🤖 Claude Opus 5.5 |
4 tasks done
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.
Closes #2648.
Each gallery group and the docs' live app shipped their wasm as a gzip -9 copy, decoded in the page by
DecompressionStream. They now ship a.zststream written byBun.zstdCompressSyncat level 19 and decoded byzstddec. On this build every group lands at 75.0–76.9% of its gzip -9 size, and zstd decodes faster than gzip does in the page (59 ms vs 103 ms on a 55 MB wasm, measured separately).Changes
web-build.mjs:compressWasmwrites<wasm>.zst;nsgo.jsonnames it withcodec,streamandstreamSizein place ofgzipandgzipSize.build-gallery.mjs: fills the loader's placeholders and copies onezstddec.mjsto the gallery root, so a visitor fetches it once.gallery-loader.html: the boot script is a module that imports the decoder; it still skips decoding when a host already did, by looking for the zstd frame magic.live.ts: same decode path, typed wherezstddecreportsArrayBufferLike.zstddec@0.3.4(MIT, 76 KB with its wasm embedded) inwebsite/package.json; README describes the new copy.web-build.test.js: the stream round-trips through the decoder.Testing
zstddec: each is exactlynsgo.json'swasmSizebytes and its sha256 equals the hash in the file's name; no.gzipremains./gallery/inputs/app.htmland/docs/ui/tabs/in headless Chrome from the built site: both mount, with no console errors.Risk
Medium. A revert restores gzip; the artifacts are generated and ignored, so no data or workflow changes.
The site's deploy workflow uses bun 1.4.4, and
Bun.zstdCompressSyncis declared inbun-types@1.4.4; the local run used bun 1.4.5. A full site build grows by about two to three minutes from compressing 15 wasm files.🤖 Claude Opus 5.5