Compiled CLI is over 200 MB; about half could be cut (part of it waits on Bun 1.5)
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 49/100
- issue の種類
- リファクタリング
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- bun, typescript
調査の方向性
Start with the release workflow’s compile step, build:hook, and pack-app.ts to trace how embedded pages, wasm, and diagram files are produced and included. The report says zstd-compressed outputs already pass scripts/smoke-pages.mjs, but sem-diff and diagram assets still need binary verification. Done means wiring compression into the build, updating the embedding comments, and verifying all embedded assets from the compiled binary.
索引モデルが issue の本文から書いたものです。
説明
The CLI download through mise is 246 MB on macOS arm64 (0.29.4), which seemed like a lot for a CLI, so I spent some time measuring where the bytes go and trying a few ways to cut it down. I'd like your thoughts before I go further.
All numbers below are macOS arm64, Bun 1.4.5, built from main at d30781afc with the release workflow's compile flags.
Where the size comes from
A current main build is 218 MB:
- Bun runtime: about 89 MB (a hello-world
bun build --compileis 89 MB on its own). - The three embedded pages:
index.html25 MB,review.html17 MB,inbox.html30 MB. Each one packs about 250 Shiki language chunks, which are 13 to 15 MB of each page. - Semantic-diff tree-sitter wasm: 20 MB.
- Diagram engine (engine, Mermaid, Graphviz): 7 MB.
- Server JS: 18 MB minified. About 9.4 MB of that is
@shikijs/langsand@shikijs/themes, pulled in server-side through@pierre/diffs/ssrinreference-handlers.ts.
The pages and wasm are embedded exactly as built, and they compress very well (the pages go from 73 MB to 16 MB with zstd, the wasm and diagram engine from 28 MB to 3 MB).
What I tried
| Build | Size |
|---|---|
| Current flags | 217.9 MB |
--minify |
212.6 MB |
--trim on 1.4.5 |
217.9 MB (no effect) |
| zstd-compressed embedded outputs | 135.6 MB |
zstd + --minify |
130.3 MB |
zstd + --minify --trim on Bun canary |
111.6 MB |
The zstd change is small: a build step writes <file>.zst next to each embedded output (the three pages, the sem-diff wasm and the diagram engine files), the server imports the .zst with type: "file" like today, and decompresses on first read with Bun.zstdDecompressSync. Decompressing the largest page takes about 20 ms. scripts/smoke-pages.mjs passes against that binary (every served page and asset byte for byte). I haven't verified sem-diff and the diagram engine from the binary yet, since the smoke doesn't cover them.
--trim is where the Bun 1.5 dependency comes in. Bun 1.4.5 accepts the flag but does nothing with it. It's only on Bun's main branch right now, listed in the Bun 1.5 tracking issue (https://github.com/oven-sh/bun/issues/49571) along with AOT, and Bun's docs mark it experimental. With bun build --compile it removes the bun CLI itself (about 45 MB). The catch is that canary executables are also bigger before trimming (179.5 MB vs 130.3 MB for the same build), because the AOT compiler is now in every executable. So the net gain over 1.4.5 is about 19 MB. The canary trimmed binary also passed smoke-pages.mjs.
Things I ruled out
--bytecode: makes executables larger, not smaller. pkg's comparison measured Bun with--bytecodeat 190 MB vs 108 MB without on the same package.bun compile/ AOT: drops the JIT (about 14 MB), but it can't cross-compile, and the release builds every target from one runner.- Sourcemaps: opencode cut 25 MB by not embedding
.mapfiles, butpack-app.tsalready rejects them, so there's nothing to gain here. mermaid-tiny: about half the size, but it drops mindmap, architecture and ELK.
Two smaller ideas I measured but didn't pursue: compressing the three pages together as one stream gets them from 16.4 MB to 9.9 MB (they share most of their chunks), but Bun's zstd API has no long-window option, so it would need the zstd CLI in the build and would unpack all three pages at once. Trimming the Shiki language list could save a few MB more, but that's a visible change, so it's your call.
Questions
- Are you open to embedding the build outputs zstd-compressed? It cuts the binary by about 82 MB with no change in behavior. I have it working on a branch and I'm happy to finish it up (wire the step into
build:hook, update the comments that explain the current embedding, verify sem-diff and diagrams from the binary) and open a PR. - Any objection to adding
--minifyto the compile step? It's another 5 MB, but stack traces and function names in the server code get shortened. - Once Bun 1.5 ships, would you want to try
--trimgiven it's experimental? I'd leave this issue open to track that.
Thanks!
- 主要言語
- TypeScript
- スター
- 8.7k
- フォーク
- 649
- 平均マージ
- 16時間 1分
- マージ済み PR(30日)
- 756
環境構築
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
backnotprop/plannotator のほかの issue
-
Inbox: numbered choices in a :::question become free text, and context bullets become the choices対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
backnotprop/plannotator#4132 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Claude Code: "classic.PermissionRequest hook was skipped" notice is back on Bash permission promptsオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
backnotprop/plannotator#4051 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
backnotprop/plannotator#4000 ·
メンテナーはふだん 1 日以内に返信
-
PR description is hidden when a PR review opens on a phone対応中かも @flipcyde101 が 8 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
backnotprop/plannotator#3667 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
backnotprop/plannotator#2643 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
backnotprop/plannotator の issue をすべて見る
似ている issue
-
enhancement UX
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
online-go/online-go.com#4000 ·
メンテナーはふだん 1 日以内に返信
-
enhancement good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
SnosMe/awakened-poe-trade#1976 ·
-
[BUG]オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 63/100
jonp-h/TillerQuest#319 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
terrazzoapp/terrazzo#902 ·