Skip to content

build: enable minify for standalone binaries#220

Merged
BYK merged 1 commit intomainfrom
build/minify-binaries
Feb 9, 2026
Merged

build: enable minify for standalone binaries#220
BYK merged 1 commit intomainfrom
build/minify-binaries

Conversation

@BYK
Copy link
Member

@BYK BYK commented Feb 9, 2026

Summary

Add minify: true to Bun.build() for standalone executables in script/build.ts.

Benchmarked all Bun compile optimization flags (minify, bytecode, sourcemap: "linked", execArgv: ["--smol"]) using hyperfine (50 runs, 5 warmup) on linux-x64:

Config Size Δ Size Startup (mean ± σ) Δ Startup Peak RSS Δ RSS
baseline 99.2 MB 337.0 ± 17.1 ms 94,080 KB
minify 98.2 MB -1% 316.7 ± 14.0 ms -6% 90,624 KB -4%
minify+smol 98.2 MB -1% 315.2 ± 12.4 ms -6% 90,624 KB -4%
minify+sourcemap 100.3 MB +1% 311.6 ± 9.2 ms -8% 92,672 KB -1%

Not shown: bytecode: true variants added +10% binary size for negligible startup improvement.

Decisions

  • minify: true — applied. Smaller binary, faster startup, less memory. No trade-off.
  • bytecode: true — rejected. +10 MB binary size, bytecode representation larger than minified source.
  • --smol — rejected. Zero measurable effect for a CLI that exits in <1s.
  • sourcemap: "linked" — deferred. +2 MB for readable stack traces, viable for the future.

Full plan and benchmark details in script/OPTIMIZE-BINARIES.md (also attached as a git note).

@github-actions
Copy link
Contributor

github-actions bot commented Feb 9, 2026

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

Cli

  • Add setup command for shell integration by BYK in #213
  • Add plural command aliases for list commands by betegon in #209

Other

  • (formatters) Display span duration in span tree by betegon in #219
  • (log) Add view command to display log entry details by betegon in #212
  • (setup) Auto-install Claude Code agent skill during setup by BYK in #216

Bug Fixes 🐛

Upgrade

  • Handle EPERM in isProcessRunning for cross-user locks by BYK in #211
  • Replace curl pipe with direct binary download by BYK in #208

Documentation 📚

  • (log) Add documentation for sentry log view command by betegon in #214
  • Add documentation for log command by betegon in #210

Internal Changes 🔧

  • (ci) Remove merge-artifacts job with Craft 2.21.1 by BYK in #215
  • (setup) Unify binary placement via setup --install by BYK in #217
  • Enable minify for standalone binaries by BYK in #220

🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 9, 2026

Codecov Results 📊

✅ Patch coverage is 100.00%. Project has 3947 uncovered lines.
✅ Project coverage is 67.47%. Comparing base (base) to head (head).

Files with missing lines (64)
File Patch % Lines
human.ts 56.12% ⚠️ 391 Missing
resolve-target.ts 15.28% ⚠️ 366 Missing
list.ts 14.39% ⚠️ 345 Missing
list.ts 23.47% ⚠️ 212 Missing
api-client.ts 69.27% ⚠️ 197 Missing
oauth.ts 25.10% ⚠️ 194 Missing
list.ts 21.96% ⚠️ 167 Missing
view.ts 22.07% ⚠️ 166 Missing
plan.ts 19.37% ⚠️ 154 Missing
help.ts 19.85% ⚠️ 109 Missing
upgrade.ts 57.71% ⚠️ 107 Missing
interactive-login.ts 9.17% ⚠️ 99 Missing
view.ts 25.81% ⚠️ 92 Missing
view.ts 47.70% ⚠️ 91 Missing
clipboard.ts 4.49% ⚠️ 85 Missing
status.ts 24.07% ⚠️ 82 Missing
view.ts 49.07% ⚠️ 82 Missing
migration.ts 47.44% ⚠️ 82 Missing
list.ts 27.18% ⚠️ 75 Missing
browser.ts 4.11% ⚠️ 70 Missing
login.ts 33.33% ⚠️ 64 Missing
span-tree.ts 5.00% ⚠️ 57 Missing
explain.ts 33.33% ⚠️ 56 Missing
telemetry.ts 79.86% ⚠️ 56 Missing
api.ts 89.80% ⚠️ 47 Missing
upgrade.ts 66.91% ⚠️ 46 Missing
seer.ts 75.54% ⚠️ 45 Missing
schema.ts 89.56% ⚠️ 40 Missing
refresh.ts 40.63% ⚠️ 38 Missing
seer.ts 79.87% ⚠️ 30 Missing
preload.ts 53.23% ⚠️ 29 Missing
utils.ts 88.94% ⚠️ 25 Missing
view.ts 61.54% ⚠️ 25 Missing
detector.ts 90.10% ⚠️ 20 Missing
binary.ts 88.67% ⚠️ 17 Missing
output.ts 15.00% ⚠️ 17 Missing
code-scanner.ts 95.00% ⚠️ 16 Missing
help.ts 57.14% ⚠️ 15 Missing
arg-parsing.ts 90.00% ⚠️ 12 Missing
dsn-cache.ts 94.62% ⚠️ 12 Missing
logout.ts 56.00% ⚠️ 11 Missing
token.ts 52.17% ⚠️ 11 Missing
fix.ts 83.61% ⚠️ 10 Missing
qrcode.ts 33.33% ⚠️ 10 Missing
fs-utils.ts 57.14% ⚠️ 9 Missing
project-root.ts 97.73% ⚠️ 7 Missing
version-check.ts 91.76% ⚠️ 7 Missing
feedback.ts 84.21% ⚠️ 6 Missing
auth.ts 95.52% ⚠️ 6 Missing
shell.ts 96.23% ⚠️ 6 Missing
app.ts 92.86% ⚠️ 5 Missing
resolver.ts 94.57% ⚠️ 5 Missing
setup.ts 97.84% ⚠️ 4 Missing
index.ts 95.96% ⚠️ 4 Missing
project-aliases.ts 97.40% ⚠️ 2 Missing
project-root-cache.ts 96.92% ⚠️ 2 Missing
json.ts 33.33% ⚠️ 2 Missing
alias.ts 99.42% ⚠️ 1 Missing
completions.ts 99.37% ⚠️ 1 Missing
env-file.ts 99.19% ⚠️ 1 Missing
parser.ts 98.63% ⚠️ 1 Missing
colors.ts 97.96% ⚠️ 1 Missing
helpers.ts 94.74% ⚠️ 1 Missing
helpers.ts 94.74% ⚠️ 1 Missing
Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    67.47%    67.47%        —%
==========================================
  Files           99        99         —
  Lines        12133     12133         —
  Branches         0         0         —
==========================================
+ Hits          8186      8186         —
- Misses        3947      3947         —
- Partials         0         0         —

Generated by Codecov Action

Add `minify: true` to the Bun.build() call in script/build.ts.

Benchmarked all optimization flags (minify, bytecode, sourcemap, --smol)
with hyperfine (50 runs, 5 warmup). minify alone was the clear winner:
-1% binary size, -6% startup time, -4% peak memory, zero trade-offs.

bytecode increased binary size +10% for negligible startup gain.
--smol had zero measurable effect for a short-lived CLI process.
sourcemap: linked is viable (+2 MB) but deferred for now.
@BYK BYK force-pushed the build/minify-binaries branch from 8c7abfd to f85e080 Compare February 9, 2026 23:31
@BYK BYK marked this pull request as ready for review February 9, 2026 23:33
@BYK BYK merged commit 66ed8bf into main Feb 9, 2026
23 checks passed
@BYK BYK deleted the build/minify-binaries branch February 9, 2026 23:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant