🧼 split layout and input entrypoints#37
Open
natemoo-re wants to merge 6 commits into
Open
Conversation
commit: |
dreyfus92
approved these changes
May 23, 2026
ghostdevv
requested changes
May 23, 2026
ghostdevv
left a comment
Member
There was a problem hiding this comment.
There are quite a few references to both wasm.ts and clayterm.wasm still
a4e9caf to
0c58432
Compare
31d049e to
0bbf6d0
Compare
cowboyd
approved these changes
May 27, 2026
cowboyd
left a comment
Collaborator
There was a problem hiding this comment.
Looks good to me. So tiny! 🤩
Member
Author
|
@cowboyd ah I need to rerun those numbers after rolling back the more aggressive stuff! still tiny but not quite this tiny (yet) |
Contributor
This comment was marked as outdated.
This comment was marked as outdated.
natemoo-re
added a commit
that referenced
this pull request
Jun 2, 2026
The opt-flags split defaulted input.wasm to -Oz (optimize for size), which ~2x'd instruction counts on the hot parse paths (multi-byte UTF-8 decode, Kitty CSI-u trie). CodSpeed flagged UTF-8 3/4-byte and Kitty regressions on PR #37. -O2 restores parse speed for +1557 bytes raw / +290 bytes gzip on a 9KB module — a negligible size cost. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Size Increased — +8.0 KB 132.2 KB unpacked |
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.
Building on #50 (brotli+z85 encoding), this PR splits the WASM compilation into two scoped modules and exposes them as separate export subpaths, enabling per-consumer dead-code elimination and per-module opt tuning.
module-layout.candmodule-input.c./layoutand./inputexport subpaths exposed viabuild-npm.ts, allows downstream bundlers to tree-shakewasm.ts; updated.gitignoreandMakefileclean targets accordinglyPer-consumer DCE
Consumer that import only one subpath no longer need to load the other module's WASM.
main)clayterm/inputclayterm/layoutFull bundle (JS + WASM), gzipped: input-only 47.8 kB → 8.5 kB (−82%); layout-only 48.8 kB → 45.4 kB (−7%).
Honest size note
Now that brotli+z85 (#50) is on
main, the split does not reduce total install size.mem/utf8/wcwidthare duplicated across both modules, so the combined WASM is ~equal (42.1 kB split vs 42.4 kB unified, brotli) and the full package is marginally larger (115.4 kB → 121.5 kB unpacked, +5.3%). The wins here are scoping and per-module tunability, not aggregate size. Narrower compilation units also let--gc-sectionsapply more aggressive DCE per module.