Skip to content

perf(cli): reduce release binary size and compare preview artifacts - #3086

Merged
fengmk2 merged 11 commits into
mainfrom
perf/binary-size-analysis
Oct 18, 2026
Merged

fengmk2 merged 11 commits into
mainfrom
perf/binary-size-analysis

Conversation

@fengmk2

@fengmk2 fengmk2 commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

This change reduces the standalone vp executable size with a step-local CARGO_PROFILE_RELEASE_OPT_LEVEL=z override. Fat LTO remains enabled for both the standalone executable and the NAPI addon. The addon contains Rolldown and Oxc and keeps its existing release settings.

Artifact Base PR
Standalone vp executable opt-level=3, lto="fat" opt-level="z", lto="fat"
NAPI addon, including Rolldown and Oxc opt-level=3, lto="fat" opt-level=3, lto="fat"

On Apple M4 Max with macOS ARM64, the executable decreases from 7,991,312 to 4,954,496 bytes (38.0% smaller). The table compares standalone CLI commands from the same source commit, a4e9c5932, with fat LTO in both builds. These CLI timings do not measure bundling. A separate vp build comparison below measures the bundled Rolldown.

Workload opt-level=3 opt-level="z" Slowdown
vp -V, no local installation 4.287 ms 4.337 ms 1.1%
vp -V, local package and toolchain manifest 4.322 ms 4.387 ms 1.5%
vp env current node --json 4.35 ms 4.50 ms 3.4%
Same command, 20 directories below the project root 4.95 ms 5.13 ms 3.6%
vp node -e '' 32.96 ms 33.06 ms 0.3%
vp env exec npm --version 70.23 ms 70.22 ms No consistent difference
vp env install 22.13.1, runtime absent 1,068 ms 1,127 ms 5.5%

The version command adds 0.05–0.07 ms. Its measurements use 360 runs per binary per workload, in three rounds with randomized execution order. Environment commands add about 0.1–0.2 ms. Fresh Node.js installation adds 59 ms.

These measurements use warm filesystem caches. Installation uses a local mirror and includes signature verification, checksum verification, and extraction. Linux and Windows performance remains unmeasured.

The vp build comparison uses the same native addon, Node.js 22.23.2, Vite 8.3.4, and Rolldown 1.2.14 for both variants. Fat LTO stays enabled. Each workload has 60 runs per variant in three rounds with balanced, randomized execution order.

vp build workload Standalone opt-level=3 Standalone opt-level="z" Change
threejs10x, 3,693 modules 525.0 ms 528.2 ms +0.6%
Same input, minification and source maps 660.9 ms 665.5 ms +0.7%
2,000 TypeScript modules, 20 dynamic chunks, minification and source maps 401.9 ms 401.4 ms -0.1%

These workloads show no consistent slowdown. Differences change sign across rounds, and all 95% confidence intervals include zero. Timings include CLI startup, bundling, and output writes, with warm filesystem caches and no task cache. These results do not measure disabling fat LTO or changing the NAPI optimization level.

For comparison, the main Rust CLIs in uv and pnpm retain opt-level=3. Both use lto="fat", codegen-units=1, symbol stripping, no debug information, and panic="abort". uv uses opt-level="z" for its separate uv-build binary.

uv's release workflow also uses profile-guided optimization on selected targets. Its macOS builds use LLD to merge identical code. pnpm's release workflow sets -C force-unwind-tables=no for the Linux CLI. Its NAPI addon keeps unwind tables and uses panic="unwind".

The preview workflow adds a PR comment that compares each binary with the latest stable release. It shows raw sizes, gzip sizes, and changes for all eight targets, including Windows installers and trampolines.

The report uses code from the default branch and reads preview binaries without executing them. It updates the existing comment only while the PR still points to the built commit.

@fengmk2
fengmk2 force-pushed the perf/binary-size-analysis branch from a5def7e to 5156822 Compare October 16, 2026 13:26
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview URL: https://perf-binary-size-analysis-viteplus-dev.voidzero-docs.workers.dev (commit b3c1a08)

This URL reflects your latest Preview deployment

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://93401ded-viteplus-dev.voidzero-docs.workers.dev b3c1a08 2026-10-18T10:10:51.388Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://d7bdb2da-viteplus-dev.voidzero-docs.workers.dev 93b8863 2026-10-18T09:51:15.187Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://6c4c96a2-viteplus-dev.voidzero-docs.workers.dev dbad6d0 2026-10-18T09:08:35.830Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://ad5525b9-viteplus-dev.voidzero-docs.workers.dev 723396f 2026-10-18T09:07:18.948Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://00c132cd-viteplus-dev.voidzero-docs.workers.dev 6a10864 2026-10-17T17:03:43.998Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://3f9a49c4-viteplus-dev.voidzero-docs.workers.dev 554d5cd 2026-10-17T06:17:12.473Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://90e1de5f-viteplus-dev.voidzero-docs.workers.dev f8dd9f8 2026-10-17T03:53:48.217Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://9b18bb57-viteplus-dev.voidzero-docs.workers.dev 26acf72 2026-10-17T03:43:11.283Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://855adbd1-viteplus-dev.voidzero-docs.workers.dev 4ee2e4e 2026-10-17T03:41:32.988Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://3cdc0760-viteplus-dev.voidzero-docs.workers.dev 632c053 2026-10-17T03:20:08.054Z Visit the dashboard ↗

View all previews: View all previews ↗

@fengmk2 fengmk2 added the preview-build Publish this PR's commits to the registry bridge as preview builds label Oct 16, 2026
@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

CLI artifact sizes (b3c1a08)

Final release artifacts built by the canonical build-upstream and build-windows-cli actions.
The dist rows use the Linux build. The core total excludes .node files to match the release artifact.

Artifact Format Base PR Change
packages/cli/dist Directory total 2.11 MiB 2.11 MiB 0 B (0.00%)
packages/core/dist Directory total 4.08 MiB 4.08 MiB 0 B (0.00%)
Combined package dist Directory total 6.19 MiB 6.19 MiB 0 B (0.00%)
vp (Linux x64) Binary 10.25 MiB 7.14 MiB -3.11 MiB (-30.33%)
vp (Linux x64) gzip -9 4.51 MiB 3.32 MiB -1.19 MiB (-26.36%)
NAPI (Linux x64) Binary 34.58 MiB 34.58 MiB 0 B (0.00%)
NAPI (Linux x64) gzip -9 13.82 MiB 13.82 MiB 0 B (0.00%)
vp (macOS ARM64) Binary 7.65 MiB 4.74 MiB -2.91 MiB (-38.05%)
vp (macOS ARM64) gzip -9 3.95 MiB 2.84 MiB -1.10 MiB (-27.96%)
NAPI (macOS ARM64) Binary 41.56 MiB 41.56 MiB 0 B (0.00%)
NAPI (macOS ARM64) gzip -9 17.99 MiB 17.99 MiB 0 B (0.00%)
vp (Windows x64) Binary 8.33 MiB 5.20 MiB -3.13 MiB (-37.56%)
vp (Windows x64) gzip -9 3.67 MiB 2.44 MiB -1.23 MiB (-33.56%)
NAPI (Windows x64) Binary 30.64 MiB 30.64 MiB 0 B (0.00%)
NAPI (Windows x64) gzip -9 12.53 MiB 12.53 MiB -4 B (-0.00%)
Trampoline (Windows x64) Binary 13.50 KiB 13.50 KiB 0 B (0.00%)
Trampoline (Windows x64) gzip -9 7.09 KiB 7.09 KiB 0 B (0.00%)
Installer (Windows x64) Binary 3.63 MiB 3.63 MiB -1.00 KiB (-0.03%)
Installer (Windows x64) gzip -9 1.78 MiB 1.78 MiB -180 B (-0.01%)

@github-actions

Copy link
Copy Markdown
Contributor

Registry bridge build (a4e9c59)

This commit build is published to the registry bridge, which serves these as ordinary npm versions (every other package proxies to npmjs):

Package Version
vite-plus 0.0.0-commit.a4e9c5932e069b5aea5b9c0136222ddada73bed0
@voidzero-dev/vite-plus-core 0.0.0-commit.a4e9c5932e069b5aea5b9c0136222ddada73bed0
create-vite-plus 0.0.0-commit.a4e9c5932e069b5aea5b9c0136222ddada73bed0

Install the Vite+ CLI built from this commit, then migrate a project:

# macOS / Linux
curl -fsSL https://raw.githubusercontent.com/voidzero-dev/vite-plus/a4e9c5932e069b5aea5b9c0136222ddada73bed0/packages/cli/install.sh | VP_PR_VERSION=3086 VP_LEGACY_INSTALLER_URL=https://raw.githubusercontent.com/voidzero-dev/vite-plus/a4e9c5932e069b5aea5b9c0136222ddada73bed0/packages/cli/install-legacy.sh bash
# Windows (PowerShell)
$env:VP_PR_VERSION="3086"; $env:VP_LEGACY_INSTALLER_URL="https://raw.githubusercontent.com/voidzero-dev/vite-plus/a4e9c5932e069b5aea5b9c0136222ddada73bed0/packages/cli/install-legacy.ps1"; irm https://raw.githubusercontent.com/voidzero-dev/vite-plus/a4e9c5932e069b5aea5b9c0136222ddada73bed0/packages/cli/install.ps1 | iex

Or download the standalone Windows installer built from this commit:

Architecture Installer
x64 vp-setup-x86_64-pc-windows-msvc.exe
Arm64 vp-setup-aarch64-pc-windows-msvc.exe

GitHub requires you to sign in and downloads each installer as a ZIP artifact. Extract vp-setup.exe, then run it against this preview build:

.\vp-setup.exe --version "0.0.0-commit.a4e9c5932e069b5aea5b9c0136222ddada73bed0" --registry "https://registry-bridge.viteplus.dev/"

After installing, upgrade the current project's vite-plus to this test build with:

vp migrate

Or create a new project from this commit without installing the CLI:

export npm_config_registry=https://registry-bridge.viteplus.dev/ pnpm_config_registry=https://registry-bridge.viteplus.dev/
pnpm create vite-plus@0.0.0-commit.a4e9c5932e069b5aea5b9c0136222ddada73bed0 # or: npm create vite-plus@0.0.0-commit.a4e9c5932e069b5aea5b9c0136222ddada73bed0
$env:npm_config_registry="https://registry-bridge.viteplus.dev/"; $env:pnpm_config_registry="https://registry-bridge.viteplus.dev/"
pnpm create vite-plus@0.0.0-commit.a4e9c5932e069b5aea5b9c0136222ddada73bed0 # or: npm create vite-plus@0.0.0-commit.a4e9c5932e069b5aea5b9c0136222ddada73bed0

pnpm 11+ reads pnpm_config_registry, npm and older pnpm read npm_config_registry. The new project pins this build, so keep the registry set for later installs, or configure it as below.

Or point your package manager at the bridge registry https://registry-bridge.viteplus.dev/:

Package manager Registry config
npm / pnpm / Bun .npmrc: registry=https://registry-bridge.viteplus.dev/
Yarn (v2+) .yarnrc.yml: npmRegistryServer: "https://registry-bridge.viteplus.dev/"

Then pin the build (vite aliases to vite-plus-core; pnpm can use a catalog, npm an overrides entry):

{
  "devDependencies": {
    "vite-plus": "0.0.0-commit.a4e9c5932e069b5aea5b9c0136222ddada73bed0",
    "vite": "npm:@voidzero-dev/vite-plus-core@0.0.0-commit.a4e9c5932e069b5aea5b9c0136222ddada73bed0"
  }
}

@github-actions

Copy link
Copy Markdown
Contributor

🐳 Docker preview image

Built from this PR's registry bridge build:

Image Compressed size
ghcr.io/voidzero-dev/vite-plus:pr-3086 225MB
# remove any stale local copy from a previous run, then pull fresh
docker rmi ghcr.io/voidzero-dev/vite-plus:pr-3086 2>/dev/null; docker pull ghcr.io/voidzero-dev/vite-plus:pr-3086

Quick check:

docker run --rm ghcr.io/voidzero-dev/vite-plus:pr-3086 vp --version

See docs/guide/docker.md for usage.

@fengmk2 fengmk2 added test: e2e Auto run e2e tests test: install-e2e run vite install e2e test test: create-e2e Run `vp create` e2e tests test: sfw labels Oct 17, 2026
@fengmk2 fengmk2 self-assigned this Oct 17, 2026
@fengmk2
fengmk2 marked this pull request as ready for review October 17, 2026 03:06
@fengmk2
fengmk2 requested a review from Brooooooklyn October 17, 2026 03:06
@fengmk2
fengmk2 marked this pull request as draft October 17, 2026 03:21
@fengmk2
fengmk2 marked this pull request as ready for review October 17, 2026 03:39
@fengmk2
fengmk2 force-pushed the perf/binary-size-analysis branch from 554d5cd to 6a10864 Compare October 17, 2026 17:02
@fengmk2

fengmk2 commented Oct 18, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-18T09:13:27.857707Z dbad6d0 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@fengmk2
fengmk2 force-pushed the perf/binary-size-analysis branch from 6a10864 to 723396f Compare October 18, 2026 09:06

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6a10864a16

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/vp-binary-size.yml Outdated
@fengmk2

fengmk2 commented Oct 18, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: dbad6d0ed8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@fengmk2
fengmk2 force-pushed the perf/binary-size-analysis branch from 93b8863 to b3c1a08 Compare October 18, 2026 10:10
@fengmk2
fengmk2 merged commit e92aaad into main Oct 18, 2026
120 checks passed
@fengmk2
fengmk2 deleted the perf/binary-size-analysis branch October 18, 2026 10:27
@fengmk2 fengmk2 mentioned this pull request Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

preview-build Publish this PR's commits to the registry bridge as preview builds test: create-e2e Run `vp create` e2e tests test: e2e Auto run e2e tests test: install-e2e run vite install e2e test test: sfw

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants