diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 54173a40e..1acccefe8 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -401,6 +401,10 @@ jobs: landing-next-e2e: runs-on: ubuntu-latest timeout-minutes: 60 + env: + # Render the frozen e2e/fixtures/benchmark-results.json, so a benchmark + # refresh on main never changes a screenshot. This build is never deployed. + LANDING_BENCHMARK_DATA: fixture steps: - name: Checkout uses: actions/checkout@v7 @@ -885,9 +889,13 @@ jobs: # changepacks compares the change against a local main, which a pull request checkout does not have git fetch --no-tags origin main:refs/heads/main bunx @changepacks/cli@latest check --format json + # The e2e builds render the frozen e2e/fixtures/benchmark-results.json, so + # a benchmark refresh on main never changes a screenshot. The site is + # deployed from a separate build of the live benchmark-results.json below. - name: Build Landing env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + LANDING_BENCHMARK_DATA: fixture run: | bun run --filter @devup-ui/components build-storybook mv ./packages/components/storybook-static ./apps/landing/public/storybook @@ -921,6 +929,7 @@ jobs: - name: Build Landing (singleCss) env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + LANDING_BENCHMARK_DATA: fixture run: | rm -rf apps/landing/dist apps/landing/.next apps/landing/.vinext apps/landing/df DEVUP_SINGLE_CSS=1 bun run --filter landing build @@ -933,6 +942,15 @@ jobs: name: playwright-report-singlecss path: playwright-report/ retention-days: 1 + # The same singleCss build as above, with the live benchmark numbers. + - name: Build Landing for deployment + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + rm -rf apps/landing/dist apps/landing/.next apps/landing/.vinext apps/landing/df + DEVUP_SINGLE_CSS=1 bun run --filter landing build + grep -q 'data-benchmark-source="live"' apps/landing/dist/client/index.html - name: Upload the site for deployment uses: actions/upload-pages-artifact@v5 with: @@ -1053,3 +1071,101 @@ jobs: NATIVE_RELEASE_BUNDLE: ${{ runner.temp }}/native-release-bundle with: publish: true + + # Publishes the numbers `benchmark` measured on a push to main: rewrites + # benchmark-results.json (the README sections and the landing page read it), + # appends the run to benchmark/history.json, and pushes that as one commit to + # main, so every merge leaves its numbers next to it and a slower build can be + # traced to the merge that caused it (`bun benchmark-refresh.js --trend `). + # + # It cannot release or loop: it waits for `release` to finish so it never + # races changepacks, it runs no build, publish or changepacks step, and the + # commit it pushes is made with GITHUB_TOKEN (whose pushes start no workflow) + # and carries [skip ci]. It records a failed gate too, so the regression is in + # the history, and skips a run whose artifact is missing. + # + # A commit older than the published results is only added to the history + # (benchmark-refresh.js checks the ancestry). If main moves during the job it + # rebuilds the commit on the new HEAD; if pushing to main keeps failing (for + # example once a ruleset protects main without a bypass for GitHub Actions), + # it pushes the commit to `chore/benchmark-refresh` and keeps one pull request + # open for it instead. + benchmark-refresh: + needs: [benchmark, release] + if: ${{ !cancelled() && github.event_name == 'push' && github.ref == 'refs/heads/main' && needs.benchmark.result != 'skipped' }} + runs-on: ubuntu-latest + timeout-minutes: 15 + concurrency: + group: benchmark-refresh-main + cancel-in-progress: false + env: + GIT_CONFIG_COUNT: "1" + GIT_CONFIG_KEY_0: core.autocrlf + GIT_CONFIG_VALUE_0: "false" + permissions: + contents: write + pull-requests: write + steps: + - name: Download the measured run + id: measured + uses: actions/download-artifact@v8 + continue-on-error: true + with: + name: benchmark-run + path: ${{ runner.temp }}/benchmark-run + - name: Checkout main + if: steps.measured.outcome == 'success' + uses: actions/checkout@v7 + with: + ref: main + # benchmark-refresh.js compares commits and reads their baselines + fetch-depth: 0 + - uses: oven-sh/setup-bun@v2 + if: steps.measured.outcome == 'success' + with: + bun-version: latest + name: Install bun + - name: Record the run and push it to main + if: steps.measured.outcome == 'success' + env: + GH_TOKEN: ${{ github.token }} + MEASURED: ${{ runner.temp }}/benchmark-run/benchmark-run.json + MESSAGE: "chore(benchmark): record run ${{ github.run_id }} of ${{ github.sha }} [skip ci]" + BRANCH: chore/benchmark-refresh + shell: bash + run: | + set -euo pipefail + git config user.name 'github-actions[bot]' + git config user.email '41898282+github-actions[bot]@users.noreply.github.com' + + # The scripts need no dependencies; only the files they write are staged. + record() { + git fetch -q origin main + git reset -q --hard origin/main + cp "$MEASURED" benchmark-run.json + bun benchmark-refresh.js + bun render-benchmark-readme.js + rm benchmark-run.json + git add -- benchmark-results.json benchmark/history.json README.md README_ko.md 'packages/*/README.md' + } + + for attempt in 1 2 3; do + record + if git diff --cached --quiet; then + echo "Nothing to record for ${GITHUB_SHA}" + exit 0 + fi + git commit -q -m "$MESSAGE" + if git push origin HEAD:refs/heads/main; then + exit 0 + fi + echo "Push to main failed (attempt ${attempt}); rebuilding on the new HEAD" + done + + echo "::warning::Could not push the benchmark refresh to main; updating ${BRANCH} instead" + git push --force origin "HEAD:refs/heads/${BRANCH}" + if [ -z "$(gh pr list --head "$BRANCH" --state open --json number --jq '.[].number')" ]; then + gh pr create --base main --head "$BRANCH" \ + --title 'chore(benchmark): record the latest main benchmark' \ + --body 'Written by the `benchmark-refresh` job because it could not push to main. It carries the latest main run only; merging it publishes the numbers and its history entry.' + fi diff --git a/README.md b/README.md index 64cb06e99..62f26df17 100644 --- a/README.md +++ b/README.md @@ -81,33 +81,33 @@ npm install @devup-ui/webpack-plugin -[Latest CI benchmark](https://github.com/dev-five-git/devup-ui/actions/runs/37758611477) (commit `467a379a`, Devup UI 1.0.44) on `ubuntu-24.04` with Next.js 16.3.3. Every row is the median of 3 cold builds that ran in rotating order, shown with the range of the samples. All Next.js builds use the native TypeScript 7 CLI for type checking. The English and Korean tables are generated from the same checked result file, `benchmark-results.json`. +[Latest CI benchmark](https://github.com/dev-five-git/devup-ui/actions/runs/43770976836) (commit `c750d33c`, Devup UI 1.0.44, 2026-11-15) on `ubuntu-26.04` with Next.js 16.4.6. Every row is the median of 3 cold builds that ran in rotating order, shown with the range of the samples. All Next.js builds use the native TypeScript 7 CLI for type checking. The English and Korean tables are generated from the same checked result file, `benchmark-results.json`, which CI refreshes after every merge to main and records in `benchmark/history.json`, one entry per commit, so a slower build can be traced to the merge that caused it. -Build Size is every byte of the build output directory (`.next`, or `dist` for vinext), including caches and server output. The checked table retains its original historical CSS measurements, which recursively counted `.css` files throughout that output. New runs count only browser-shipped CSS: `.next/static/**/*.css` (Webpack `static/css` and Turbopack `static/chunks`) or vinext `dist/client/**/*.css`, excluding caches and server CSS. A missing browser-assets directory is an error; an existing directory with no CSS counts zero. Approved CSS measurement corrections are limited to explicitly named `devup-ui`, `devup-ui-single` and `vinext-devup-ui` rows. `bun benchmark-check.js --write-css-baseline devup-ui` retains the per-file mode; `bun benchmark-check.js --write-css-baseline devup-ui-single,vinext-devup-ui` selects only the other two rows in one comma-separated argument. Only selected existing rows' CSS bytes change; unlike `--write-baseline`, this preserves sample count, build bytes, ratios, tolerances, all unselected rows and calibration history. Missing or unsupported names and conflicting writer modes are rejected. +Client Size is the JavaScript and CSS shipped to the browser, uncompressed: `.next/static/**/*.{js,css}` or vinext `dist/client/**/*.{js,css}`. Build Size (incl. caches) is every byte of the build output directory (`.next`, or `dist` for vinext); most of it is the bundler cache and server output, and it moves by a few kilobytes between identical builds, so it is kept for continuity rather than as what users download. CSS Size counts only browser-shipped CSS: `.next/static/**/*.css` (Webpack `static/css` and Turbopack `static/chunks`) or vinext `dist/client/**/*.css`, excluding caches and server CSS. A missing browser-assets directory is an error; an existing directory with no CSS counts zero. Every size is measured on every sample and shown as the median; `benchmark-results.json` keeps the samples with their range, and rows measured before Client Size was recorded show n/a. Approved CSS measurement corrections are limited to explicitly named `devup-ui`, `devup-ui-single` and `vinext-devup-ui` rows. `bun benchmark-check.js --write-css-baseline devup-ui` retains the per-file mode; `bun benchmark-check.js --write-css-baseline devup-ui-single,vinext-devup-ui` selects only the other two rows in one comma-separated argument. Only selected existing rows' CSS bytes change; unlike `--write-baseline`, this preserves sample count, build bytes, ratios, tolerances, all unselected rows and calibration history. Missing or unsupported names and conflicting writer modes are rejected. Webpack: -| Library | Version | Median Build Time | Range | Build Size | CSS Size | -| --------------------------- | ------- | ----------------- | --------------- | ----------------- | ------------ | -| tailwindcss | 4.3.3 | 13.02s | 12.91s - 13.20s | 67,339,250 bytes | 5,852 bytes | -| styleX | 0.19.0 | 29.01s | 28.72s - 29.50s | 96,290,533 bytes | 425 bytes | -| vanilla-extract | 1.21.2 | 12.34s | 12.22s - 12.35s | 68,565,511 bytes | 294 bytes | -| kuma-ui | 1.6.4 | 13.55s | 13.49s - 13.57s | 75,627,429 bytes | 340 bytes | -| panda-css | 1.12.0 | 13.44s | 13.29s - 13.58s | 71,849,243 bytes | 15,615 bytes | -| chakra-ui | 3.37.0 | 20.29s | 19.95s - 21.06s | 207,425,028 bytes | 0 bytes | -| mui | 9.4.0 | 14.12s | 13.78s - 14.26s | 101,476,098 bytes | 0 bytes | -| **devup-ui (per-file CSS)** | 1.0.44 | **10.95s** | 10.87s - 11.09s | 67,427,695 bytes | 562 bytes | -| **devup-ui (single CSS)** | 1.0.44 | **11.04s** | 10.88s - 11.40s | 67,436,336 bytes | 790 bytes | +| Library | Version | Median Build Time | Range | Client Size | Build Size (incl. caches) | CSS Size | +| --------------------------- | ------- | ----------------- | --------------- | ----------- | ------------------------- | ------------ | +| tailwindcss | 4.3.5 | 10.23s | 10.16s - 11.07s | n/a | 69,807,397 bytes | 5,851 bytes | +| styleX | 0.19.2 | 24.33s | 24.04s - 25.58s | n/a | 99,500,267 bytes | 425 bytes | +| vanilla-extract | 1.21.3 | 10.14s | 9.56s - 10.29s | n/a | 70,957,513 bytes | 294 bytes | +| kuma-ui | 1.6.4 | 11.13s | 10.38s - 11.65s | n/a | 77,951,297 bytes | 340 bytes | +| panda-css | 2.5.0 | 11.04s | 10.14s - 11.22s | n/a | 75,860,686 bytes | 21,149 bytes | +| chakra-ui | 3.38.0 | 16.33s | 16.05s - 16.37s | n/a | 211,095,734 bytes | 0 bytes | +| mui | 9.5.0 | 11.33s | 10.65s - 12.03s | n/a | 104,631,987 bytes | 0 bytes | +| **devup-ui (per-file CSS)** | 1.0.44 | **9.11s** | 8.61s - 9.27s | n/a | 69,803,573 bytes | 494 bytes | +| **devup-ui (single CSS)** | 1.0.44 | **9.23s** | 8.65s - 9.31s | n/a | 69,788,823 bytes | 395 bytes | Turbopack: -| Library | Version | Median Build Time | Range | Build Size | CSS Size | -| -------------------------------------- | ------- | ----------------- | ------------- | ---------------- | ----------- | -| tailwindcss | 4.3.3 | 5.68s | 5.51s - 5.73s | 38,440,013 bytes | 6,197 bytes | -| **devup-ui (direct APIs, single CSS)** | 1.0.44 | **5.79s** | 5.77s - 5.87s | 36,538,765 bytes | 327 bytes | -| **devup-ui (static `.css.ts`)** | 1.0.44 | **5.71s** | 5.67s - 5.99s | 36,580,207 bytes | 268 bytes | +| Library | Version | Median Build Time | Range | Client Size | Build Size (incl. caches) | CSS Size | +| -------------------------------------- | ------- | ----------------- | ------------- | ----------- | ------------------------- | ----------- | +| tailwindcss | 4.3.5 | 3.91s | 3.65s - 3.94s | n/a | 30,536,946 bytes | 6,196 bytes | +| **devup-ui (direct APIs, single CSS)** | 1.0.44 | **3.85s** | 3.60s - 4.02s | n/a | 28,905,488 bytes | 327 bytes | +| **devup-ui (static `.css.ts`)** | 1.0.44 | **3.91s** | 3.61s - 3.95s | n/a | 28,950,340 bytes | 268 bytes | -The Turbopack ranges do not overlap, so the direct-API median is 0.12s (2.1%) behind Tailwind on this fixture. The 3 cold samples were Tailwind `5.68s, 5.73s, 5.51s`, direct Devup UI `5.77s, 5.79s, 5.87s`, and static `.css.ts` `5.71s, 5.99s, 5.67s`. The fixtures have comparable app shapes, not pixel-identical styling: Tailwind styles the leading paragraph and button more heavily, while Devup UI exercises typed component/style props. Treat these as build-pipeline results rather than a per-rule microbenchmark. Every `.css.ts` module runs on the full Boa evaluator, which adds about 20 ms for the first module and under 1 ms for each further one. CI compares the Devup UI rows with a checked baseline (see `benchmark-gate.js` for the rule) and fails on a regression beyond the measured noise. +The Turbopack ranges overlap, so the direct-API median is 0.05s (1.3%) ahead of Tailwind on this fixture and the two are effectively at parity. The 3 cold samples were Tailwind `3.94s, 3.65s, 3.91s`, direct Devup UI `3.85s, 3.60s, 4.02s`, and static `.css.ts` `3.95s, 3.61s, 3.91s`. The fixtures have comparable app shapes, not pixel-identical styling: Tailwind styles the leading paragraph and button more heavily, while Devup UI exercises typed component/style props. Treat these as build-pipeline results rather than a per-rule microbenchmark. Every `.css.ts` module runs on the full Boa evaluator, which adds about 20 ms for the first module and under 1 ms for each further one. CI compares the Devup UI rows with a checked baseline (see `benchmark-gate.js` for the rule) and fails on a regression beyond the measured noise. ## How it works diff --git a/README_ko.md b/README_ko.md index cf342fa5e..8938a2a03 100644 --- a/README_ko.md +++ b/README_ko.md @@ -81,33 +81,33 @@ npm install @devup-ui/webpack-plugin -[최신 CI 벤치마크](https://github.com/dev-five-git/devup-ui/actions/runs/37758611477) (커밋 `467a379a`, Devup UI 1.0.44)는 `ubuntu-24.04`에서 Next.js 16.3.3로 실행했습니다. 모든 행은 순서를 돌려 가며 측정한 cold build 3회의 중앙값이며 샘플의 범위를 함께 보여줍니다. 모든 Next.js 빌드는 네이티브 TypeScript 7 CLI로 타입 검사를 수행합니다. 영어와 한국어 표는 같은 결과 파일 `benchmark-results.json`에서 생성합니다. +[최신 CI 벤치마크](https://github.com/dev-five-git/devup-ui/actions/runs/43770976836) (커밋 `c750d33c`, Devup UI 1.0.44, 2026-11-15)는 `ubuntu-26.04`에서 Next.js 16.4.6로 실행했습니다. 모든 행은 순서를 돌려 가며 측정한 cold build 3회의 중앙값이며 샘플의 범위를 함께 보여줍니다. 모든 Next.js 빌드는 네이티브 TypeScript 7 CLI로 타입 검사를 수행합니다. 영어와 한국어 표는 같은 결과 파일 `benchmark-results.json`에서 생성합니다. CI는 main에 병합될 때마다 이 파일을 갱신하고 커밋마다 하나씩 `benchmark/history.json`에 기록하므로, 빌드가 느려지면 원인이 된 병합을 찾을 수 있습니다. -빌드 사이즈는 캐시와 서버 출력을 포함한 빌드 출력 디렉터리(`.next`, vinext는 `dist`)의 모든 바이트입니다. 체크인된 표는 출력 전체의 `.css` 파일을 재귀적으로 합산한 기존 CSS 측정값을 그대로 보존합니다. 새 실행은 브라우저에 제공되는 CSS만 측정합니다: `.next/static/**/*.css`(Webpack `static/css`, Turbopack `static/chunks`) 또는 vinext `dist/client/**/*.css`. 캐시와 서버 CSS는 제외합니다. 브라우저 에셋 디렉터리가 없으면 오류이며, 존재하지만 CSS가 없으면 0입니다. 승인된 CSS 측정 보정은 명시적으로 지정한 `devup-ui`, `devup-ui-single`, `vinext-devup-ui` 행으로 제한됩니다. `bun benchmark-check.js --write-css-baseline devup-ui`는 기존 per-file 모드를 유지하며, `bun benchmark-check.js --write-css-baseline devup-ui-single,vinext-devup-ui`는 쉼표로 구분한 인자 하나로 나머지 두 행만 선택합니다. 선택한 기존 행의 CSS 바이트만 바꾸고, `--write-baseline`과 달리 샘플 수, 빌드 바이트, 비율, 허용 오차, 선택하지 않은 모든 행과 보정 이력을 보존합니다. 이름 누락, 지원하지 않는 이름, 다른 쓰기 모드와의 혼용은 오류입니다. +클라이언트 사이즈는 브라우저에 제공되는 JavaScript와 CSS의 압축 전 크기입니다: `.next/static/**/*.{js,css}` 또는 vinext `dist/client/**/*.{js,css}`. 빌드 사이즈(캐시 포함)는 빌드 출력 디렉터리(`.next`, vinext는 `dist`)의 모든 바이트입니다. 대부분이 번들러 캐시와 서버 출력이고 같은 빌드끼리도 수 KB씩 달라지므로, 사용자가 받는 크기가 아니라 이전 결과와의 연속성을 위해 남겨 둡니다. CSS 사이즈는 브라우저에 제공되는 CSS만 측정합니다: `.next/static/**/*.css`(Webpack `static/css`, Turbopack `static/chunks`) 또는 vinext `dist/client/**/*.css`. 캐시와 서버 CSS는 제외합니다. 브라우저 에셋 디렉터리가 없으면 오류이며, 존재하지만 CSS가 없으면 0입니다. 모든 사이즈는 샘플마다 측정해 중앙값으로 보여 주며, `benchmark-results.json`에는 샘플과 범위가 함께 남습니다. 클라이언트 사이즈를 기록하기 전에 측정한 행은 n/a로 표시합니다. 승인된 CSS 측정 보정은 명시적으로 지정한 `devup-ui`, `devup-ui-single`, `vinext-devup-ui` 행으로 제한됩니다. `bun benchmark-check.js --write-css-baseline devup-ui`는 기존 per-file 모드를 유지하며, `bun benchmark-check.js --write-css-baseline devup-ui-single,vinext-devup-ui`는 쉼표로 구분한 인자 하나로 나머지 두 행만 선택합니다. 선택한 기존 행의 CSS 바이트만 바꾸고, `--write-baseline`과 달리 샘플 수, 빌드 바이트, 비율, 허용 오차, 선택하지 않은 모든 행과 보정 이력을 보존합니다. 이름 누락, 지원하지 않는 이름, 다른 쓰기 모드와의 혼용은 오류입니다. Webpack: -| 라이브러리 | 버전 | 빌드 시간 중앙값 | 범위 | 빌드 사이즈 | CSS 사이즈 | -| --------------------------- | ------ | ---------- | --------------- | ----------------- | ------------ | -| tailwindcss | 4.3.3 | 13.02s | 12.91s - 13.20s | 67,339,250 bytes | 5,852 bytes | -| styleX | 0.19.0 | 29.01s | 28.72s - 29.50s | 96,290,533 bytes | 425 bytes | -| vanilla-extract | 1.21.2 | 12.34s | 12.22s - 12.35s | 68,565,511 bytes | 294 bytes | -| kuma-ui | 1.6.4 | 13.55s | 13.49s - 13.57s | 75,627,429 bytes | 340 bytes | -| panda-css | 1.12.0 | 13.44s | 13.29s - 13.58s | 71,849,243 bytes | 15,615 bytes | -| chakra-ui | 3.37.0 | 20.29s | 19.95s - 21.06s | 207,425,028 bytes | 0 bytes | -| mui | 9.4.0 | 14.12s | 13.78s - 14.26s | 101,476,098 bytes | 0 bytes | -| **devup-ui (per-file CSS)** | 1.0.44 | **10.95s** | 10.87s - 11.09s | 67,427,695 bytes | 562 bytes | -| **devup-ui (single CSS)** | 1.0.44 | **11.04s** | 10.88s - 11.40s | 67,436,336 bytes | 790 bytes | +| 라이브러리 | 버전 | 빌드 시간 중앙값 | 범위 | 클라이언트 사이즈 | 빌드 사이즈(캐시 포함) | CSS 사이즈 | +| --------------------------- | ------ | --------- | --------------- | --------- | ----------------- | ------------ | +| tailwindcss | 4.3.5 | 10.23s | 10.16s - 11.07s | n/a | 69,807,397 bytes | 5,851 bytes | +| styleX | 0.19.2 | 24.33s | 24.04s - 25.58s | n/a | 99,500,267 bytes | 425 bytes | +| vanilla-extract | 1.21.3 | 10.14s | 9.56s - 10.29s | n/a | 70,957,513 bytes | 294 bytes | +| kuma-ui | 1.6.4 | 11.13s | 10.38s - 11.65s | n/a | 77,951,297 bytes | 340 bytes | +| panda-css | 2.5.0 | 11.04s | 10.14s - 11.22s | n/a | 75,860,686 bytes | 21,149 bytes | +| chakra-ui | 3.38.0 | 16.33s | 16.05s - 16.37s | n/a | 211,095,734 bytes | 0 bytes | +| mui | 9.5.0 | 11.33s | 10.65s - 12.03s | n/a | 104,631,987 bytes | 0 bytes | +| **devup-ui (per-file CSS)** | 1.0.44 | **9.11s** | 8.61s - 9.27s | n/a | 69,803,573 bytes | 494 bytes | +| **devup-ui (single CSS)** | 1.0.44 | **9.23s** | 8.65s - 9.31s | n/a | 69,788,823 bytes | 395 bytes | Turbopack: -| 라이브러리 | 버전 | 빌드 시간 중앙값 | 범위 | 빌드 사이즈 | CSS 사이즈 | -| -------------------------------------- | ------ | --------- | ------------- | ---------------- | ----------- | -| tailwindcss | 4.3.3 | 5.68s | 5.51s - 5.73s | 38,440,013 bytes | 6,197 bytes | -| **devup-ui (direct APIs, single CSS)** | 1.0.44 | **5.79s** | 5.77s - 5.87s | 36,538,765 bytes | 327 bytes | -| **devup-ui (static `.css.ts`)** | 1.0.44 | **5.71s** | 5.67s - 5.99s | 36,580,207 bytes | 268 bytes | +| 라이브러리 | 버전 | 빌드 시간 중앙값 | 범위 | 클라이언트 사이즈 | 빌드 사이즈(캐시 포함) | CSS 사이즈 | +| -------------------------------------- | ------ | --------- | ------------- | --------- | ---------------- | ----------- | +| tailwindcss | 4.3.5 | 3.91s | 3.65s - 3.94s | n/a | 30,536,946 bytes | 6,196 bytes | +| **devup-ui (direct APIs, single CSS)** | 1.0.44 | **3.85s** | 3.60s - 4.02s | n/a | 28,905,488 bytes | 327 bytes | +| **devup-ui (static `.css.ts`)** | 1.0.44 | **3.91s** | 3.61s - 3.95s | n/a | 28,950,340 bytes | 268 bytes | -Turbopack 측정 범위는 겹치지 않으므로 direct API 중앙값은 이 fixture에서 Tailwind보다 0.12s(2.1%) 느리며. cold 샘플 3개는 Tailwind `5.68s, 5.73s, 5.51s`, direct Devup UI `5.77s, 5.79s, 5.87s`, static `.css.ts` `5.71s, 5.99s, 5.67s`입니다. fixture는 앱 구조만 비슷하고 스타일이 픽셀 단위로 같지는 않습니다. Tailwind는 첫 문단과 버튼에 더 많은 스타일을 주고, Devup UI는 타입이 있는 컴포넌트/스타일 props를 사용합니다. 규칙 단위 마이크로벤치마크가 아니라 빌드 파이프라인 결과로 보세요. 모든 `.css.ts`는 full Boa evaluator로 처리하며, 첫 모듈에 약 20ms, 이후 모듈마다 1ms 미만이 더 듭니다. CI는 Devup UI 행을 체크인된 기준값과 비교해 측정된 노이즈를 넘는 회귀에서 실패합니다(규칙은 `benchmark-gate.js`). +Turbopack 측정 범위는 서로 겹치므로 direct API 중앙값은 이 fixture에서 Tailwind보다 0.05s(1.3%) 빠르며 사실상 동률입니다. cold 샘플 3개는 Tailwind `3.94s, 3.65s, 3.91s`, direct Devup UI `3.85s, 3.60s, 4.02s`, static `.css.ts` `3.95s, 3.61s, 3.91s`입니다. fixture는 앱 구조만 비슷하고 스타일이 픽셀 단위로 같지는 않습니다. Tailwind는 첫 문단과 버튼에 더 많은 스타일을 주고, Devup UI는 타입이 있는 컴포넌트/스타일 props를 사용합니다. 규칙 단위 마이크로벤치마크가 아니라 빌드 파이프라인 결과로 보세요. 모든 `.css.ts`는 full Boa evaluator로 처리하며, 첫 모듈에 약 20ms, 이후 모듈마다 1ms 미만이 더 듭니다. CI는 Devup UI 행을 체크인된 기준값과 비교해 측정된 노이즈를 넘는 회귀에서 실패합니다(규칙은 `benchmark-gate.js`). ## 작동 원리 diff --git a/apps/landing/src/app/Bench.tsx b/apps/landing/src/app/Bench.tsx index 085c6f1e0..9f8510d32 100644 --- a/apps/landing/src/app/Bench.tsx +++ b/apps/landing/src/app/Bench.tsx @@ -1,65 +1,65 @@ -import { Flex, Text, VStack } from '@devup-ui/react' +import { css, Flex, Text, VStack } from '@devup-ui/react' import { BenchBox } from './BenchBox' +import { BENCHMARK_SOURCE, benchmarkResults as results } from './benchmark-data' import { DevupUICard } from './DevupUICard' import { OtherCard } from './OtherCard' -const OTHER_CARDS = [ - { - title: 'Chakra UI', - version: '3.37.0', - buildTime: '19.98s', - buildSize: '197.02MB', - url: 'https://chakra-ui.com', - }, - { - title: 'Mui', - version: '9.4.0', - buildTime: '13.78s', - buildSize: '95.94MB', - url: 'https://mui.com', - }, - { - title: 'Kuma UI', - version: '1.6.4', - buildTime: '13.07s', - buildSize: '71.28MB', - url: 'https://kuma-ui.com', - }, - { - title: 'Tailwindcss', - version: '4.3.3', - buildTime: '12.81s', - buildSize: '63.37MB', - url: 'https://tailwindcss.com', - }, - { - title: 'panda CSS', - version: '1.12.0', - buildTime: '13.20s', - buildSize: '67.68MB', - url: 'https://panda-css.com', - }, - { - title: 'styleX', - version: '0.19.0', - buildTime: '27.61s', - buildSize: '91.00MB', - url: 'https://stylexjs.com', - }, +// The numbers come from benchmark-data.ts: the live benchmark-results.json, or +// the frozen e2e fixture in the e2e builds. +const WEBPACK = new Map( + results.rows + .filter((row) => row.table === 'webpack') + .map((row) => [row.target, row]), +) + +function row(target: string) { + const found = WEBPACK.get(target) + if (!found) + throw new Error(`benchmark-results.json has no webpack ${target} row`) + return found +} + +const seconds = (value: number) => `${value.toFixed(2)}s` +const megabytes = (value: number) => `${(value / 1024 / 1024).toFixed(2)}MB` + +const OTHERS = [ + { title: 'Chakra UI', target: 'chakra-ui', url: 'https://chakra-ui.com' }, + { title: 'Mui', target: 'mui', url: 'https://mui.com' }, + { title: 'Kuma UI', target: 'kuma-ui', url: 'https://kuma-ui.com' }, + { title: 'Tailwindcss', target: 'tailwind', url: 'https://tailwindcss.com' }, + { title: 'panda CSS', target: 'panda-css', url: 'https://panda-css.com' }, + { title: 'styleX', target: 'stylex', url: 'https://stylexjs.com' }, { title: 'vanilla extract', - version: '1.21.2', - buildTime: '11.96s', - buildSize: '64.55MB', + target: 'vanilla-extract', url: 'https://vanilla-extract.style', }, -] +].map(({ target, ...card }) => ({ ...card, row: row(target) })) + +const OTHER_CARDS = OTHERS.map(({ row, ...card }) => ({ + ...card, + version: row.version, + buildTime: seconds(row.median), + buildSize: megabytes(row.bytes), +})) + +const devup = row('devup-ui-single') +const DEVUP_CARD = { + version: results.run.devupUi, + buildTime: seconds(devup.median), + buildSize: megabytes(devup.bytes), + fastest: OTHERS.every(({ row }) => devup.median <= row.median), + smallest: OTHERS.every(({ row }) => devup.bytes <= row.bytes), +} + +const link = css({ color: 'inherit' }) export function Bench() { return ( - Next.js 16.3.3 cold build (GitHub Actions, run 33254030962) + Next.js {results.run.next} cold build, median of {results.samples}{' '} + (GitHub Actions{' '} + + run {results.run.id} + + , commit{' '} + + {results.run.commit} + + ) - + - + {OTHER_CARDS.map((item) => ( diff --git a/apps/landing/src/app/DevupUICard.tsx b/apps/landing/src/app/DevupUICard.tsx index 21ed70758..8021fefac 100644 --- a/apps/landing/src/app/DevupUICard.tsx +++ b/apps/landing/src/app/DevupUICard.tsx @@ -1,6 +1,38 @@ import { Box, Flex, Image, Text, VStack } from '@devup-ui/react' -export function DevupUICard() { +interface DevupUICardProps { + version: string + buildTime: string + buildSize: string + /** Whether Devup UI builds faster than every other card */ + fastest: boolean + /** Whether Devup UI builds smaller than every other card */ + smallest: boolean +} + +function Crown({ shown }: { shown: boolean }) { + // Always laid out, so the card keeps its shape when Devup UI is not ahead. + return ( + + ) +} + +export function DevupUICard({ + version, + buildTime, + buildSize, + fastest, + smallest, +}: DevupUICardProps) { return ( - 1.0.40 + {version} @@ -39,21 +71,14 @@ export function DevupUICard() { Next.js Build Time (single CSS) - + - 10.81s + {buildTime} @@ -62,21 +87,14 @@ export function DevupUICard() { Build Size - + - 63.45MB + {buildSize} diff --git a/apps/landing/src/app/benchmark-data.ts b/apps/landing/src/app/benchmark-data.ts new file mode 100644 index 000000000..2c8538018 --- /dev/null +++ b/apps/landing/src/app/benchmark-data.ts @@ -0,0 +1,16 @@ +import live from '../../../../benchmark-results.json' +import fixture from '../../../../e2e/fixtures/benchmark-results.json' + +// The landing page shows the checked benchmark-results.json, which CI rewrites +// after every merge to main (benchmark-refresh.js), so the page shows the same +// run as the READMEs. +// +// The e2e builds set LANDING_BENCHMARK_DATA=fixture and render the frozen +// e2e/fixtures/benchmark-results.json instead, so a benchmark refresh never +// changes a screenshot baseline. Bench is a server component prerendered at +// build time, so this choice is made by the build and ships no client code. +export const BENCHMARK_SOURCE = + process.env.LANDING_BENCHMARK_DATA === 'fixture' ? 'fixture' : 'live' + +export const benchmarkResults: typeof live = + BENCHMARK_SOURCE === 'fixture' ? fixture : live diff --git a/benchmark-check.js b/benchmark-check.js index 37d3897c6..e1fbc2d18 100644 --- a/benchmark-check.js +++ b/benchmark-check.js @@ -11,7 +11,8 @@ // // A change that makes a build slower or larger on purpose runs the two writes // on a CI run's `benchmark-run` artifact and commits the files in the same pull -// request. +// request. After a merge, CI rewrites benchmark-results.json on main itself and +// records the run in benchmark/history.json (benchmark-refresh.js). import { readFileSync, writeFileSync } from 'node:fs' import { @@ -20,6 +21,7 @@ import { nextCssBaseline, report, } from './benchmark-gate.js' +import { applyRun, formatJson } from './benchmark-record.js' const read = (file) => JSON.parse(readFileSync(file, 'utf8')) const write = (file, value) => @@ -50,25 +52,10 @@ if (process.argv.includes('--write-css-baseline')) { write('benchmark-baseline.json', nextBaseline(run, manifest, previous)) console.info('benchmark-baseline.json rewritten') } else if (process.argv.includes('--write-results')) { - const results = read('benchmark-results.json') - const runId = run.run.id ?? results.run.id - results.run = { - ...results.run, - id: runId, - url: `https://github.com/dev-five-git/devup-ui/actions/runs/${runId}`, - commit: (run.run.commit ?? results.run.commit).slice(0, 8), - } - results.samples = run.samples - results.rows = results.rows.map((row) => ({ - ...row, - samples: run.rows[row.target].samples, - median: run.rows[row.target].median, - min: run.rows[row.target].min, - max: run.rows[row.target].max, - bytes: run.rows[row.target].bytes, - cssBytes: run.rows[row.target].cssBytes, - })) - write('benchmark-results.json', results) + writeFileSync( + 'benchmark-results.json', + formatJson(applyRun(read('benchmark-results.json'), run)), + ) console.info('benchmark-results.json rewritten') } else { const baseline = read('benchmark-baseline.json') diff --git a/benchmark-manifest.json b/benchmark-manifest.json index 257f34d93..4511f6f8f 100644 --- a/benchmark-manifest.json +++ b/benchmark-manifest.json @@ -28,5 +28,29 @@ "webpack": "tailwind", "turbopack": "tailwind-turbo", "vite": "tailwind" + }, + "packages": { + "tailwind": "tailwindcss", + "stylex": "@stylexjs/stylex", + "stylex-turbo": "@stylexjs/stylex", + "stylex-turbo-devup-ui": "@devup-ui/react", + "vanilla-extract": "@vanilla-extract/css", + "kuma-ui": "@kuma-ui/core", + "panda-css": "@pandacss/dev", + "chakra-ui": "@chakra-ui/react", + "mui": "@mui/material", + "devup-ui": "@devup-ui/react", + "devup-ui-single": "@devup-ui/react", + "tailwind-turbo": "tailwindcss", + "devup-ui-single-turbo": "@devup-ui/react", + "devup-ui-turbo": "@devup-ui/react", + "vanilla-extract-devup-ui": "@devup-ui/react", + "tailwind-turbo-devup-ui": "@devup-ui/react", + "vinext-devup-ui": "@devup-ui/react", + "devup-ui-collapse": "@devup-ui/react", + "devup-ui-large": "@devup-ui/react", + "devup-ui-large-wasm": "@devup-ui/react", + "devup-ui-large-turbo": "@devup-ui/react", + "devup-ui-large-turbo-wasm": "@devup-ui/react" } } diff --git a/benchmark-output.js b/benchmark-output.js index efc9c28f2..3290112a7 100644 --- a/benchmark-output.js +++ b/benchmark-output.js @@ -2,19 +2,25 @@ import { existsSync, readdirSync, statSync } from 'node:fs' import { join } from 'node:path' -/** Sum all files, or only CSS files, recursively. Missing directories throw. */ -function directoryBytes(directory, cssOnly = false) { +const isCss = (path) => path.endsWith('.css') +const isClientCode = (path) => /\.(?:css|m?js)$/.test(path) + +/** Sum the files `include` accepts, recursively. Missing directories throw. */ +function directoryBytes(directory, include = () => true) { let bytes = 0 for (const entry of readdirSync(directory)) { const path = join(directory, entry) const stat = statSync(path) - if (stat.isDirectory()) bytes += directoryBytes(path, cssOnly) - else if (!cssOnly || path.endsWith('.css')) bytes += stat.size + if (stat.isDirectory()) bytes += directoryBytes(path, include) + else if (include(path)) bytes += stat.size } return bytes } -/** Whole-build bytes include caches/server output; CSS bytes are shipped assets only. */ +/** + * Whole-build bytes include caches/server output. CSS bytes and client bytes + * are browser-shipped assets only: the CSS, and the JavaScript plus CSS. + */ export function measureOutput(benchmarkDir) { // vinext also leaves a vestigial .next stub: keep preferring dist. const distDir = join(benchmarkDir, 'dist') @@ -25,6 +31,7 @@ export function measureOutput(benchmarkDir) { bytes: directoryBytes(outputDir), // Next Webpack uses static/css; Turbopack uses static/chunks. // An existing empty browser directory counts zero; a missing one throws. - cssBytes: directoryBytes(browserDir, true), + cssBytes: directoryBytes(browserDir, isCss), + clientBytes: directoryBytes(browserDir, isClientCode), } } diff --git a/benchmark-record.js b/benchmark-record.js new file mode 100644 index 000000000..10414f772 --- /dev/null +++ b/benchmark-record.js @@ -0,0 +1,178 @@ +// What a benchmark run leaves behind, kept free of file, git and process access +// so it can be tested. `benchmark.js` summarizes the samples of each row, +// `benchmark-check.js --write-results` and `benchmark-refresh.js` turn a run +// into benchmark-results.json (the README tables and the landing page), and +// `benchmark-refresh.js` appends it to benchmark/history.json, one entry per +// commit of main, so a regression can be traced to the merge that caused it. + +import { evaluate, median } from './benchmark-gate.js' + +export const HISTORY_LIMIT = 500 +export const HISTORY_COLUMNS = [ + 'median', + 'min', + 'max', + 'bytes', + 'cssBytes', + 'clientBytes', +] +const RUNS_URL = 'https://github.com/dev-five-git/devup-ui/actions/runs/' +const PRINT_WIDTH = 80 + +/** Seconds to the millisecond; the tables show hundredths */ +export const round = (value) => Math.round(value * 1000) / 1000 + +/** The median and range of one size measured on every sample */ +export function sizeSummary(samples) { + return { + samples, + median: median(samples), + min: Math.min(...samples), + max: Math.max(...samples), + } +} + +/** One row of benchmark-run.json from the samples of a target */ +export function summarizeRow({ seconds, bytes, cssBytes, clientBytes }) { + const sizes = { + bytes: sizeSummary(bytes), + cssBytes: sizeSummary(cssBytes), + clientBytes: sizeSummary(clientBytes), + } + return { + samples: seconds, + median: median(seconds), + min: Math.min(...seconds), + max: Math.max(...seconds), + bytes: sizes.bytes.median, + cssBytes: sizes.cssBytes.median, + clientBytes: sizes.clientBytes.median, + sizes, + } +} + +/** benchmark-results.json updated with a run; rows keep their table, label and order */ +export function applyRun(results, run) { + const id = run.run.id ?? results.run.id + const sha = run.run.commit ?? results.run.sha + return { + ...results, + run: { + ...results.run, + id, + url: RUNS_URL + id, + sha, + commit: sha.slice(0, 8), + date: run.run.date ?? results.run.date, + runner: run.run.runner ?? results.run.runner, + next: run.run.next ?? results.run.next, + devupUi: run.run.devupUi ?? results.run.devupUi, + }, + samples: run.samples, + rows: results.rows.map((row) => { + const measured = run.rows[row.target] + if (!measured) + throw new TypeError(`the run has no ${row.target} row for the tables`) + return { + ...row, + version: measured.version ?? row.version, + samples: measured.samples.map(round), + median: round(measured.median), + min: round(measured.min), + max: round(measured.max), + bytes: measured.bytes, + cssBytes: measured.cssBytes, + clientBytes: measured.clientBytes ?? null, + sizes: measured.sizes ?? null, + } + }), + } +} + +/** The history entry of a run: every row in HISTORY_COLUMNS order, and what the gate said */ +export function historyEntry(run, baseline, committedAt) { + const evaluation = evaluate(run, baseline) + return { + sha: run.run.commit, + run: run.run.id, + committedAt, + measuredAt: run.run.date ?? null, + devupUi: run.run.devupUi ?? null, + samples: run.samples, + gate: evaluation.failed ? 'fail' : 'pass', + regressions: evaluation.results + .filter((result) => result.failures.length) + .map((result) => result.target), + rows: Object.fromEntries( + Object.entries(run.rows).map(([target, row]) => [ + target, + [ + round(row.median), + round(row.min), + round(row.max), + row.bytes, + row.cssBytes, + row.clientBytes ?? null, + ], + ]), + ), + } +} + +/** The history with the entry added (replacing a re-run of its commit), in commit order, capped */ +export function addToHistory(history, entry, limit = HISTORY_LIMIT) { + const entries = [ + ...(history?.entries ?? []).filter((kept) => kept.sha !== entry.sha), + entry, + ] + .toSorted((a, b) => a.committedAt.localeCompare(b.committedAt)) + .slice(-limit) + return { columns: HISTORY_COLUMNS, entries } +} + +/** + * Whether a measured commit may replace the published results: it must be on + * main, and the published results must not come from a later commit. `isAncestor` + * answers `git merge-base --is-ancestor`, with null when git does not know a commit. + */ +export function refreshPlan({ measured, head, published }, isAncestor) { + if (isAncestor(measured, head) !== true) + return { history: false, results: false, reason: 'not on main' } + if (published && isAncestor(published, measured) === false) + return { + history: true, + results: false, + reason: `the published results come from a later commit (${published.slice(0, 8)})`, + } + return { history: true, results: true, reason: 'newer or the same commit' } +} + +/** One line per history entry for a row: its time against the control of the same run */ +export function trend(history, target, control) { + return history.entries + .filter((entry) => entry.rows[target]) + .map((entry) => { + const [time, , , bytes, cssBytes, clientBytes] = entry.rows[target] + const base = entry.rows[control]?.[0] + const ratio = base ? ` ${(time / base).toFixed(3)}x ${control}` : '' + const client = clientBytes === null ? '' : `, client ${clientBytes}` + return `${entry.sha.slice(0, 8)} ${entry.committedAt} ${entry.gate} ${time.toFixed(2)}s${ratio}, ${bytes} bytes, css ${cssBytes}${client}` + }) + .join('\n') +} + +/** JSON as Prettier prints it here: two spaces, short arrays of numbers or strings on one line */ +export function formatJson(value) { + return ( + JSON.stringify(value, null, 2).replace( + /^( *)(.*)\[\n((?:\1 {2}(?:-?[\d.e+-]+|"[^"\n]*"|null),?\n)+)\1\]/gm, + (whole, indent, key, items) => { + const line = `${indent}${key}[${items + .trim() + .split(/,\n */) + .join(', ')}]` + return line.length + 1 <= PRINT_WIDTH ? line : whole + }, + ) + '\n' + ) +} diff --git a/benchmark-refresh.js b/benchmark-refresh.js new file mode 100644 index 000000000..c6753249c --- /dev/null +++ b/benchmark-refresh.js @@ -0,0 +1,82 @@ +// Records a main run of the benchmark job: CI runs it after a push to main on a +// checkout of main's current HEAD, with the run's benchmark-run.json. +// +// bun benchmark-refresh.js add the run to benchmark/history.json and, +// unless a later commit is already published, +// rewrite benchmark-results.json from it +// bun benchmark-refresh.js --trend print the history of one row +// +// The README sections are regenerated afterwards by render-benchmark-readme.js; +// the landing page imports benchmark-results.json itself. The rules live in +// benchmark-record.js. +import { execFileSync, spawnSync } from 'node:child_process' +import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs' +import { dirname } from 'node:path' + +import { + addToHistory, + applyRun, + formatJson, + historyEntry, + refreshPlan, + trend, +} from './benchmark-record.js' + +const HISTORY = 'benchmark/history.json' + +const read = (file) => JSON.parse(readFileSync(file, 'utf8')) +const write = (file, value) => writeFileSync(file, formatJson(value)) +const git = (...args) => execFileSync('git', args, { encoding: 'utf8' }).trim() +const history = () => + existsSync(HISTORY) ? read(HISTORY) : { columns: [], entries: [] } + +if (process.argv.includes('--trend')) { + const target = process.argv[process.argv.indexOf('--trend') + 1] + const manifest = read('benchmark-manifest.json') + const group = manifest.targets.find((entry) => entry.name === target)?.group + if (!group) throw new TypeError(`benchmark-manifest.json has no ${target}`) + console.info(trend(history(), target, manifest.controls[group])) +} else { + const run = read('benchmark-run.json') + const results = read('benchmark-results.json') + const measured = run.run.commit + if (!measured) throw new TypeError('benchmark-run.json names no commit') + + const isAncestor = (ancestor, descendant) => { + const { status } = spawnSync('git', [ + 'merge-base', + '--is-ancestor', + ancestor, + descendant, + ]) + return status === 0 ? true : status === 1 ? false : null + } + const plan = refreshPlan( + { measured, head: git('rev-parse', 'HEAD'), published: results.run.sha }, + isAncestor, + ) + console.info(`benchmark-refresh: ${measured.slice(0, 8)}: ${plan.reason}`) + + if (plan.history) { + // The gate verdict uses the baseline the measured commit was checked against. + let baseline + try { + baseline = JSON.parse(git('show', `${measured}:benchmark-baseline.json`)) + } catch { + baseline = read('benchmark-baseline.json') + } + const committedAt = new Date( + Number(git('show', '-s', '--format=%ct', measured)) * 1000, + ).toISOString() + mkdirSync(dirname(HISTORY), { recursive: true }) + write( + HISTORY, + addToHistory(history(), historyEntry(run, baseline, committedAt)), + ) + console.info(`benchmark-refresh: ${HISTORY} updated`) + } + if (plan.results) { + write('benchmark-results.json', applyRun(results, run)) + console.info('benchmark-refresh: benchmark-results.json rewritten') + } +} diff --git a/benchmark-results.json b/benchmark-results.json index 6546d9ae5..7f08cc795 100644 --- a/benchmark-results.json +++ b/benchmark-results.json @@ -1,11 +1,13 @@ { "run": { - "id": "37758611477", - "url": "https://github.com/dev-five-git/devup-ui/actions/runs/37758611477", - "commit": "467a379a", - "runner": "ubuntu-24.04", - "next": "16.3.3", - "devupUi": "1.0.44" + "id": "43770976836", + "url": "https://github.com/dev-five-git/devup-ui/actions/runs/43770976836", + "commit": "c750d33c", + "runner": "ubuntu-26.04", + "next": "16.4.6", + "devupUi": "1.0.44", + "sha": "c750d33c01593b9debc8f9d1b745db0774fab519", + "date": "2026-11-15T23:37:42.586Z" }, "samples": 3, "rows": [ @@ -13,85 +15,99 @@ "table": "webpack", "target": "tailwind", "label": "tailwindcss", - "version": "4.3.3", - "samples": [13.19597508, 13.021540712999995, 12.911684594999999], - "median": 13.021540712999995, - "min": 12.911684594999999, - "max": 13.19597508, - "bytes": 67339250, - "cssBytes": 5852 + "version": "4.3.5", + "samples": [10.16, 10.234, 11.069], + "median": 10.234, + "min": 10.16, + "max": 11.069, + "bytes": 69807397, + "cssBytes": 5851, + "clientBytes": null, + "sizes": null }, { "table": "webpack", "target": "stylex", "label": "styleX", - "version": "0.19.0", - "samples": [29.49553623, 28.717898384, 29.01065776699997], - "median": 29.01065776699997, - "min": 28.717898384, - "max": 29.49553623, - "bytes": 96290533, - "cssBytes": 425 + "version": "0.19.2", + "samples": [24.333, 24.037, 25.579], + "median": 24.333, + "min": 24.037, + "max": 25.579, + "bytes": 99500267, + "cssBytes": 425, + "clientBytes": null, + "sizes": null }, { "table": "webpack", "target": "vanilla-extract", "label": "vanilla-extract", - "version": "1.21.2", - "samples": [12.34335704699999, 12.346740351999994, 12.215919330999954], - "median": 12.34335704699999, - "min": 12.215919330999954, - "max": 12.346740351999994, - "bytes": 68565511, - "cssBytes": 294 + "version": "1.21.3", + "samples": [9.564, 10.294, 10.137], + "median": 10.137, + "min": 9.564, + "max": 10.294, + "bytes": 70957513, + "cssBytes": 294, + "clientBytes": null, + "sizes": null }, { "table": "webpack", "target": "kuma-ui", "label": "kuma-ui", "version": "1.6.4", - "samples": [13.566745991999996, 13.491478220999998, 13.550664844000014], - "median": 13.550664844000014, - "min": 13.491478220999998, - "max": 13.566745991999996, - "bytes": 75627429, - "cssBytes": 340 + "samples": [10.383, 11.655, 11.127], + "median": 11.127, + "min": 10.383, + "max": 11.655, + "bytes": 77951297, + "cssBytes": 340, + "clientBytes": null, + "sizes": null }, { "table": "webpack", "target": "panda-css", "label": "panda-css", - "version": "1.12.0", - "samples": [13.581986012000009, 13.292706686999997, 13.438533212000038], - "median": 13.438533212000038, - "min": 13.292706686999997, - "max": 13.581986012000009, - "bytes": 71849243, - "cssBytes": 15615 + "version": "2.5.0", + "samples": [10.141, 11.043, 11.219], + "median": 11.043, + "min": 10.141, + "max": 11.219, + "bytes": 75860686, + "cssBytes": 21149, + "clientBytes": null, + "sizes": null }, { "table": "webpack", "target": "chakra-ui", "label": "chakra-ui", - "version": "3.37.0", - "samples": [21.061893298000008, 19.949156122000016, 20.292663101000013], - "median": 20.292663101000013, - "min": 19.949156122000016, - "max": 21.061893298000008, - "bytes": 207425028, - "cssBytes": 0 + "version": "3.38.0", + "samples": [16.046, 16.328, 16.372], + "median": 16.328, + "min": 16.046, + "max": 16.372, + "bytes": 211095734, + "cssBytes": 0, + "clientBytes": null, + "sizes": null }, { "table": "webpack", "target": "mui", "label": "mui", - "version": "9.4.0", - "samples": [14.264408890999999, 13.777297842, 14.11791713899991], - "median": 14.11791713899991, - "min": 13.777297842, - "max": 14.264408890999999, - "bytes": 101476098, - "cssBytes": 0 + "version": "9.5.0", + "samples": [10.647, 11.331, 12.03], + "median": 11.331, + "min": 10.647, + "max": 12.03, + "bytes": 104631987, + "cssBytes": 0, + "clientBytes": null, + "sizes": null }, { "table": "webpack", @@ -99,12 +115,14 @@ "label": "devup-ui (per-file CSS)", "version": "1.0.44", "devup": true, - "samples": [11.089230005999998, 10.872500918999984, 10.948686922999913], - "median": 10.948686922999913, - "min": 10.872500918999984, - "max": 11.089230005999998, - "bytes": 67427695, - "cssBytes": 562 + "samples": [9.106, 8.607, 9.266], + "median": 9.106, + "min": 8.607, + "max": 9.266, + "bytes": 69803573, + "cssBytes": 494, + "clientBytes": null, + "sizes": null }, { "table": "webpack", @@ -112,24 +130,28 @@ "label": "devup-ui (single CSS)", "version": "1.0.44", "devup": true, - "samples": [11.042549753, 11.396381741000019, 10.884128520000028], - "median": 11.042549753, - "min": 10.884128520000028, - "max": 11.396381741000019, - "bytes": 67436336, - "cssBytes": 790 + "samples": [9.226, 8.653, 9.309], + "median": 9.226, + "min": 8.653, + "max": 9.309, + "bytes": 69788823, + "cssBytes": 395, + "clientBytes": null, + "sizes": null }, { "table": "turbopack", "target": "tailwind-turbo", "label": "tailwindcss", - "version": "4.3.3", - "samples": [5.6750599369999835, 5.72619077299998, 5.509298593999935], - "median": 5.6750599369999835, - "min": 5.509298593999935, - "max": 5.72619077299998, - "bytes": 38440013, - "cssBytes": 6197 + "version": "4.3.5", + "samples": [3.937, 3.65, 3.906], + "median": 3.906, + "min": 3.65, + "max": 3.937, + "bytes": 30536946, + "cssBytes": 6196, + "clientBytes": null, + "sizes": null }, { "table": "turbopack", @@ -137,12 +159,14 @@ "label": "devup-ui (direct APIs, single CSS)", "version": "1.0.44", "devup": true, - "samples": [5.765447661000013, 5.794053518000001, 5.874383794999972], - "median": 5.794053518000001, - "min": 5.765447661000013, - "max": 5.874383794999972, - "bytes": 36538765, - "cssBytes": 327 + "samples": [3.855, 3.605, 4.021], + "median": 3.855, + "min": 3.605, + "max": 4.021, + "bytes": 28905488, + "cssBytes": 327, + "clientBytes": null, + "sizes": null }, { "table": "turbopack", @@ -150,12 +174,14 @@ "label": "devup-ui (static `.css.ts`)", "version": "1.0.44", "devup": true, - "samples": [5.713730899999995, 5.988215032999986, 5.674502772999985], - "median": 5.713730899999995, - "min": 5.674502772999985, - "max": 5.988215032999986, - "bytes": 36580207, - "cssBytes": 268 + "samples": [3.953, 3.613, 3.91], + "median": 3.91, + "min": 3.613, + "max": 3.953, + "bytes": 28950340, + "cssBytes": 268, + "clientBytes": null, + "sizes": null } ] } diff --git a/benchmark.js b/benchmark.js index 27c2228b8..f18fce76e 100644 --- a/benchmark.js +++ b/benchmark.js @@ -7,15 +7,20 @@ // spread (min and max); the median is what gets compared and published. // // The machine-readable run goes to benchmark-run.json: `benchmark-check.js` -// compares it with the checked baseline, and the README tables are written from -// the checked results (benchmark-results.json, render-benchmark-readme.js). +// compares it with the checked baseline, and the README tables and the landing +// page are written from the checked results (benchmark-results.json), which CI +// refreshes from this file after every merge to main (benchmark-refresh.js). +// +// Every size is measured on every sample; a row reports the median and keeps +// the samples with their range (`sizes`). import { existsSync, readFileSync, rmSync, writeFileSync } from 'node:fs' -import { join } from 'node:path' +import { dirname, join } from 'node:path' import { execSync } from 'child_process' -import { median, roundOrder } from './benchmark-gate.js' +import { roundOrder } from './benchmark-gate.js' import { measureOutput } from './benchmark-output.js' +import { summarizeRow } from './benchmark-record.js' const manifest = JSON.parse(readFileSync('benchmark-manifest.json', 'utf8')) @@ -29,10 +34,40 @@ function clearBuildFile(dir) { let benchmarkRun = 0 +/** Short names ('tailwind' -> next-tailwind) and full names ('vinext-devup-ui') */ +function fixtureDir(target) { + return existsSync(join('./benchmark', target, 'package.json')) + ? target + : 'next-' + target +} + +/** The installed version of a package as a fixture resolves it, or null */ +function installedVersion(dir, name) { + let directory = join(process.cwd(), 'benchmark', dir) + for (;;) { + const file = join(directory, 'node_modules', name, 'package.json') + if (existsSync(file)) return JSON.parse(readFileSync(file, 'utf8')).version + if (dirname(directory) === directory) return null + directory = dirname(directory) + } +} + +/** `ubuntu-26.04` from /etc/os-release, or null off Linux */ +function runnerName() { + if (!existsSync('/etc/os-release')) return null + const release = Object.fromEntries( + readFileSync('/etc/os-release', 'utf8') + .split('\n') + .map((line) => line.match(/^(\w+)="?([^"]*)"?$/)?.slice(1)) + .filter(Boolean), + ) + return release.ID && release.VERSION_ID + ? `${release.ID}-${release.VERSION_ID}` + : null +} + function benchmark(target) { - // Support both short names ('tailwind' -> next-tailwind) and full names ('vinext-devup-ui') - const hasDir = existsSync(join('./benchmark', target, 'package.json')) - const dir = hasDir ? target : 'next-' + target + const dir = fixtureDir(target) const run = `${target}-${benchmarkRun++}` clearBuildFile(dir) @@ -54,7 +89,10 @@ function benchmark(target) { const names = manifest.targets.map((target) => target.name) const samples = new Map( - names.map((name) => [name, { seconds: [], bytes: [], cssBytes: [] }]), + names.map((name) => [ + name, + { seconds: [], bytes: [], cssBytes: [], clientBytes: [] }, + ]), ) for (let round = 0; round < manifest.samples; round++) { @@ -64,31 +102,28 @@ for (let round = 0; round < manifest.samples; round++) { row.seconds.push(sample.seconds) row.bytes.push(sample.bytes) row.cssBytes.push(sample.cssBytes) + row.clientBytes.push(sample.clientBytes) } } const rows = Object.fromEntries( - names.map((name) => { - const { seconds, bytes, cssBytes } = samples.get(name) - return [ - name, - { - samples: seconds, - median: median(seconds), - min: Math.min(...seconds), - max: Math.max(...seconds), - bytes: median(bytes), - cssBytes: median(cssBytes), - }, - ] - }), + names.map((name) => [ + name, + { + ...summarizeRow(samples.get(name)), + // The library version the fixture built with, for the README tables + version: manifest.packages[name] + ? installedVersion(fixtureDir(name), manifest.packages[name]) + : null, + }, + ]), ) console.info( names .map((name) => { const row = rows[name] - return `${name} median ${row.median.toFixed(2)}s (${row.samples.length} cold samples: ${row.samples.map((sample) => sample.toFixed(2) + 's').join(', ')}) ${row.bytes.toLocaleString()} bytes (css ${row.cssBytes.toLocaleString()} bytes)` + return `${name} median ${row.median.toFixed(2)}s (${row.samples.length} cold samples: ${row.samples.map((sample) => sample.toFixed(2) + 's').join(', ')}) ${row.bytes.toLocaleString()} bytes (css ${row.cssBytes.toLocaleString()} bytes, client ${row.clientBytes.toLocaleString()} bytes)` }) .join('\n'), ) @@ -100,6 +135,11 @@ writeFileSync( run: { id: process.env.GITHUB_RUN_ID ?? null, commit: process.env.GITHUB_SHA ?? null, + date: new Date().toISOString(), + runner: runnerName(), + next: installedVersion(fixtureDir('tailwind'), 'next'), + devupUi: JSON.parse(readFileSync('packages/react/package.json', 'utf8')) + .version, }, samples: manifest.samples, rows, diff --git a/benchmark/history.json b/benchmark/history.json new file mode 100644 index 000000000..0167a1dfd --- /dev/null +++ b/benchmark/history.json @@ -0,0 +1,39 @@ +{ + "columns": ["median", "min", "max", "bytes", "cssBytes", "clientBytes"], + "entries": [ + { + "sha": "c750d33c01593b9debc8f9d1b745db0774fab519", + "run": "43770976836", + "committedAt": "2026-11-15T22:44:40.000Z", + "measuredAt": "2026-11-15T23:37:42.586Z", + "devupUi": "1.0.44", + "samples": 3, + "gate": "pass", + "regressions": [], + "rows": { + "tailwind": [10.234, 10.16, 11.069, 69807397, 5851, null], + "stylex": [24.333, 24.037, 25.579, 99500267, 425, null], + "stylex-turbo": [4.496, 4.329, 4.696, 26941607, 424, null], + "stylex-turbo-devup-ui": [3.948, 3.777, 4.028, 24801570, 321, null], + "vanilla-extract": [10.137, 9.564, 10.294, 70957513, 294, null], + "kuma-ui": [11.127, 10.383, 11.655, 77951297, 340, null], + "panda-css": [11.043, 10.141, 11.219, 75860686, 21149, null], + "chakra-ui": [16.328, 16.046, 16.372, 211095734, 0, null], + "mui": [11.331, 10.647, 12.03, 104631987, 0, null], + "devup-ui": [9.106, 8.607, 9.266, 69803573, 494, null], + "devup-ui-single": [9.226, 8.653, 9.309, 69788823, 395, null], + "tailwind-turbo": [3.906, 3.65, 3.937, 30536946, 6196, null], + "devup-ui-single-turbo": [3.855, 3.605, 4.021, 28905488, 327, null], + "devup-ui-turbo": [4.006, 3.685, 4.04, 28922033, 358, null], + "vanilla-extract-devup-ui": [3.91, 3.613, 3.953, 28950340, 268, null], + "tailwind-turbo-devup-ui": [3.822, 3.521, 3.865, 28950865, 1011, null], + "vinext-devup-ui": [1.789, 1.71, 1.907, 1276742, 10055, null], + "devup-ui-collapse": [3.861, 3.846, 3.888, 25317694, 1286, null], + "devup-ui-large": [12.999, 12.784, 13.16, 88451010, 1592, null], + "devup-ui-large-wasm": [14.174, 13.617, 14.359, 88564324, 1592, null], + "devup-ui-large-turbo": [5.558, 5.397, 5.921, 38522739, 1512, null], + "devup-ui-large-turbo-wasm": [5.93, 5.654, 6.273, 38565212, 1512, null] + } + } + ] +} diff --git a/e2e/components-pages.spec.ts-snapshots/components-benchmark-section-mobile-linux.png b/e2e/components-pages.spec.ts-snapshots/components-benchmark-section-mobile-linux.png index e2a7d3ddf..df888f342 100644 Binary files a/e2e/components-pages.spec.ts-snapshots/components-benchmark-section-mobile-linux.png and b/e2e/components-pages.spec.ts-snapshots/components-benchmark-section-mobile-linux.png differ diff --git a/e2e/fixtures/benchmark-results.json b/e2e/fixtures/benchmark-results.json new file mode 100644 index 000000000..7f08cc795 --- /dev/null +++ b/e2e/fixtures/benchmark-results.json @@ -0,0 +1,187 @@ +{ + "run": { + "id": "43770976836", + "url": "https://github.com/dev-five-git/devup-ui/actions/runs/43770976836", + "commit": "c750d33c", + "runner": "ubuntu-26.04", + "next": "16.4.6", + "devupUi": "1.0.44", + "sha": "c750d33c01593b9debc8f9d1b745db0774fab519", + "date": "2026-11-15T23:37:42.586Z" + }, + "samples": 3, + "rows": [ + { + "table": "webpack", + "target": "tailwind", + "label": "tailwindcss", + "version": "4.3.5", + "samples": [10.16, 10.234, 11.069], + "median": 10.234, + "min": 10.16, + "max": 11.069, + "bytes": 69807397, + "cssBytes": 5851, + "clientBytes": null, + "sizes": null + }, + { + "table": "webpack", + "target": "stylex", + "label": "styleX", + "version": "0.19.2", + "samples": [24.333, 24.037, 25.579], + "median": 24.333, + "min": 24.037, + "max": 25.579, + "bytes": 99500267, + "cssBytes": 425, + "clientBytes": null, + "sizes": null + }, + { + "table": "webpack", + "target": "vanilla-extract", + "label": "vanilla-extract", + "version": "1.21.3", + "samples": [9.564, 10.294, 10.137], + "median": 10.137, + "min": 9.564, + "max": 10.294, + "bytes": 70957513, + "cssBytes": 294, + "clientBytes": null, + "sizes": null + }, + { + "table": "webpack", + "target": "kuma-ui", + "label": "kuma-ui", + "version": "1.6.4", + "samples": [10.383, 11.655, 11.127], + "median": 11.127, + "min": 10.383, + "max": 11.655, + "bytes": 77951297, + "cssBytes": 340, + "clientBytes": null, + "sizes": null + }, + { + "table": "webpack", + "target": "panda-css", + "label": "panda-css", + "version": "2.5.0", + "samples": [10.141, 11.043, 11.219], + "median": 11.043, + "min": 10.141, + "max": 11.219, + "bytes": 75860686, + "cssBytes": 21149, + "clientBytes": null, + "sizes": null + }, + { + "table": "webpack", + "target": "chakra-ui", + "label": "chakra-ui", + "version": "3.38.0", + "samples": [16.046, 16.328, 16.372], + "median": 16.328, + "min": 16.046, + "max": 16.372, + "bytes": 211095734, + "cssBytes": 0, + "clientBytes": null, + "sizes": null + }, + { + "table": "webpack", + "target": "mui", + "label": "mui", + "version": "9.5.0", + "samples": [10.647, 11.331, 12.03], + "median": 11.331, + "min": 10.647, + "max": 12.03, + "bytes": 104631987, + "cssBytes": 0, + "clientBytes": null, + "sizes": null + }, + { + "table": "webpack", + "target": "devup-ui", + "label": "devup-ui (per-file CSS)", + "version": "1.0.44", + "devup": true, + "samples": [9.106, 8.607, 9.266], + "median": 9.106, + "min": 8.607, + "max": 9.266, + "bytes": 69803573, + "cssBytes": 494, + "clientBytes": null, + "sizes": null + }, + { + "table": "webpack", + "target": "devup-ui-single", + "label": "devup-ui (single CSS)", + "version": "1.0.44", + "devup": true, + "samples": [9.226, 8.653, 9.309], + "median": 9.226, + "min": 8.653, + "max": 9.309, + "bytes": 69788823, + "cssBytes": 395, + "clientBytes": null, + "sizes": null + }, + { + "table": "turbopack", + "target": "tailwind-turbo", + "label": "tailwindcss", + "version": "4.3.5", + "samples": [3.937, 3.65, 3.906], + "median": 3.906, + "min": 3.65, + "max": 3.937, + "bytes": 30536946, + "cssBytes": 6196, + "clientBytes": null, + "sizes": null + }, + { + "table": "turbopack", + "target": "devup-ui-single-turbo", + "label": "devup-ui (direct APIs, single CSS)", + "version": "1.0.44", + "devup": true, + "samples": [3.855, 3.605, 4.021], + "median": 3.855, + "min": 3.605, + "max": 4.021, + "bytes": 28905488, + "cssBytes": 327, + "clientBytes": null, + "sizes": null + }, + { + "table": "turbopack", + "target": "vanilla-extract-devup-ui", + "label": "devup-ui (static `.css.ts`)", + "version": "1.0.44", + "devup": true, + "samples": [3.953, 3.613, 3.91], + "median": 3.91, + "min": 3.613, + "max": 3.953, + "bytes": 28950340, + "cssBytes": 268, + "clientBytes": null, + "sizes": null + } + ] +} diff --git a/e2e/landing-benchmark-fixture.spec.ts b/e2e/landing-benchmark-fixture.spec.ts new file mode 100644 index 000000000..ff2eabb34 --- /dev/null +++ b/e2e/landing-benchmark-fixture.spec.ts @@ -0,0 +1,45 @@ +import { readFileSync } from 'node:fs' + +import { expect, test } from '@playwright/test' + +// The screenshot baselines show the benchmark section, so the e2e builds render +// the frozen e2e/fixtures/benchmark-results.json instead of the live +// benchmark-results.json that CI rewrites after every merge to main. These +// checks fail when a build under test reads the live file, which would make a +// benchmark refresh change the screenshots. +const fixture = JSON.parse( + readFileSync( + new URL('./fixtures/benchmark-results.json', import.meta.url), + 'utf8', + ), +) as { + run: { id: string } + rows: { table: string; target: string; median: number; bytes: number }[] +} + +test.describe('Landing Page - Benchmark fixture', () => { + test('the benchmark section is built from the e2e fixture', async ({ + page, + }) => { + await page.goto('/') + const section = page.locator('[data-benchmark-source]') + await expect(section).toHaveCount(1) + await expect(section).toHaveAttribute('data-benchmark-source', 'fixture') + }) + + test('the benchmark section shows the fixture numbers', async ({ page }) => { + const devup = fixture.rows.find( + (row) => row.table === 'webpack' && row.target === 'devup-ui-single', + ) + if (!devup) + throw new Error('the fixture has no webpack devup-ui-single row') + + await page.goto('/') + const section = page.locator('[data-benchmark-source]') + await expect(section).toContainText(`run ${fixture.run.id}`) + await expect(section).toContainText(`${devup.median.toFixed(2)}s`) + await expect(section).toContainText( + `${(devup.bytes / 1024 / 1024).toFixed(2)}MB`, + ) + }) +}) diff --git a/e2e/landing-visual-dark.spec.ts-snapshots/dark-section-bench-linux.png b/e2e/landing-visual-dark.spec.ts-snapshots/dark-section-bench-linux.png index d3915a034..7a88ea939 100644 Binary files a/e2e/landing-visual-dark.spec.ts-snapshots/dark-section-bench-linux.png and b/e2e/landing-visual-dark.spec.ts-snapshots/dark-section-bench-linux.png differ diff --git a/e2e/landing-visual.spec.ts-snapshots/section-bench-linux.png b/e2e/landing-visual.spec.ts-snapshots/section-bench-linux.png index 3e4c5b00e..1c46bcbea 100644 Binary files a/e2e/landing-visual.spec.ts-snapshots/section-bench-linux.png and b/e2e/landing-visual.spec.ts-snapshots/section-bench-linux.png differ diff --git a/packages/components/README.md b/packages/components/README.md index 6599946ad..47c28c055 100644 --- a/packages/components/README.md +++ b/packages/components/README.md @@ -101,33 +101,33 @@ for each component's props. -[Latest CI benchmark](https://github.com/dev-five-git/devup-ui/actions/runs/37758611477) (commit `467a379a`, Devup UI 1.0.44) on `ubuntu-24.04` with Next.js 16.3.3. Every row is the median of 3 cold builds that ran in rotating order, shown with the range of the samples. All Next.js builds use the native TypeScript 7 CLI for type checking. The English and Korean tables are generated from the same checked result file, `benchmark-results.json`. +[Latest CI benchmark](https://github.com/dev-five-git/devup-ui/actions/runs/43770976836) (commit `c750d33c`, Devup UI 1.0.44, 2026-11-15) on `ubuntu-26.04` with Next.js 16.4.6. Every row is the median of 3 cold builds that ran in rotating order, shown with the range of the samples. All Next.js builds use the native TypeScript 7 CLI for type checking. The English and Korean tables are generated from the same checked result file, `benchmark-results.json`, which CI refreshes after every merge to main and records in `benchmark/history.json`, one entry per commit, so a slower build can be traced to the merge that caused it. -Build Size is every byte of the build output directory (`.next`, or `dist` for vinext), including caches and server output. The checked table retains its original historical CSS measurements, which recursively counted `.css` files throughout that output. New runs count only browser-shipped CSS: `.next/static/**/*.css` (Webpack `static/css` and Turbopack `static/chunks`) or vinext `dist/client/**/*.css`, excluding caches and server CSS. A missing browser-assets directory is an error; an existing directory with no CSS counts zero. Approved CSS measurement corrections are limited to explicitly named `devup-ui`, `devup-ui-single` and `vinext-devup-ui` rows. `bun benchmark-check.js --write-css-baseline devup-ui` retains the per-file mode; `bun benchmark-check.js --write-css-baseline devup-ui-single,vinext-devup-ui` selects only the other two rows in one comma-separated argument. Only selected existing rows' CSS bytes change; unlike `--write-baseline`, this preserves sample count, build bytes, ratios, tolerances, all unselected rows and calibration history. Missing or unsupported names and conflicting writer modes are rejected. +Client Size is the JavaScript and CSS shipped to the browser, uncompressed: `.next/static/**/*.{js,css}` or vinext `dist/client/**/*.{js,css}`. Build Size (incl. caches) is every byte of the build output directory (`.next`, or `dist` for vinext); most of it is the bundler cache and server output, and it moves by a few kilobytes between identical builds, so it is kept for continuity rather than as what users download. CSS Size counts only browser-shipped CSS: `.next/static/**/*.css` (Webpack `static/css` and Turbopack `static/chunks`) or vinext `dist/client/**/*.css`, excluding caches and server CSS. A missing browser-assets directory is an error; an existing directory with no CSS counts zero. Every size is measured on every sample and shown as the median; `benchmark-results.json` keeps the samples with their range, and rows measured before Client Size was recorded show n/a. Approved CSS measurement corrections are limited to explicitly named `devup-ui`, `devup-ui-single` and `vinext-devup-ui` rows. `bun benchmark-check.js --write-css-baseline devup-ui` retains the per-file mode; `bun benchmark-check.js --write-css-baseline devup-ui-single,vinext-devup-ui` selects only the other two rows in one comma-separated argument. Only selected existing rows' CSS bytes change; unlike `--write-baseline`, this preserves sample count, build bytes, ratios, tolerances, all unselected rows and calibration history. Missing or unsupported names and conflicting writer modes are rejected. Webpack: -| Library | Version | Median Build Time | Range | Build Size | CSS Size | -| --------------------------- | ------- | ----------------- | --------------- | ----------------- | ------------ | -| tailwindcss | 4.3.3 | 13.02s | 12.91s - 13.20s | 67,339,250 bytes | 5,852 bytes | -| styleX | 0.19.0 | 29.01s | 28.72s - 29.50s | 96,290,533 bytes | 425 bytes | -| vanilla-extract | 1.21.2 | 12.34s | 12.22s - 12.35s | 68,565,511 bytes | 294 bytes | -| kuma-ui | 1.6.4 | 13.55s | 13.49s - 13.57s | 75,627,429 bytes | 340 bytes | -| panda-css | 1.12.0 | 13.44s | 13.29s - 13.58s | 71,849,243 bytes | 15,615 bytes | -| chakra-ui | 3.37.0 | 20.29s | 19.95s - 21.06s | 207,425,028 bytes | 0 bytes | -| mui | 9.4.0 | 14.12s | 13.78s - 14.26s | 101,476,098 bytes | 0 bytes | -| **devup-ui (per-file CSS)** | 1.0.44 | **10.95s** | 10.87s - 11.09s | 67,427,695 bytes | 562 bytes | -| **devup-ui (single CSS)** | 1.0.44 | **11.04s** | 10.88s - 11.40s | 67,436,336 bytes | 790 bytes | +| Library | Version | Median Build Time | Range | Client Size | Build Size (incl. caches) | CSS Size | +| --------------------------- | ------- | ----------------- | --------------- | ----------- | ------------------------- | ------------ | +| tailwindcss | 4.3.5 | 10.23s | 10.16s - 11.07s | n/a | 69,807,397 bytes | 5,851 bytes | +| styleX | 0.19.2 | 24.33s | 24.04s - 25.58s | n/a | 99,500,267 bytes | 425 bytes | +| vanilla-extract | 1.21.3 | 10.14s | 9.56s - 10.29s | n/a | 70,957,513 bytes | 294 bytes | +| kuma-ui | 1.6.4 | 11.13s | 10.38s - 11.65s | n/a | 77,951,297 bytes | 340 bytes | +| panda-css | 2.5.0 | 11.04s | 10.14s - 11.22s | n/a | 75,860,686 bytes | 21,149 bytes | +| chakra-ui | 3.38.0 | 16.33s | 16.05s - 16.37s | n/a | 211,095,734 bytes | 0 bytes | +| mui | 9.5.0 | 11.33s | 10.65s - 12.03s | n/a | 104,631,987 bytes | 0 bytes | +| **devup-ui (per-file CSS)** | 1.0.44 | **9.11s** | 8.61s - 9.27s | n/a | 69,803,573 bytes | 494 bytes | +| **devup-ui (single CSS)** | 1.0.44 | **9.23s** | 8.65s - 9.31s | n/a | 69,788,823 bytes | 395 bytes | Turbopack: -| Library | Version | Median Build Time | Range | Build Size | CSS Size | -| -------------------------------------- | ------- | ----------------- | ------------- | ---------------- | ----------- | -| tailwindcss | 4.3.3 | 5.68s | 5.51s - 5.73s | 38,440,013 bytes | 6,197 bytes | -| **devup-ui (direct APIs, single CSS)** | 1.0.44 | **5.79s** | 5.77s - 5.87s | 36,538,765 bytes | 327 bytes | -| **devup-ui (static `.css.ts`)** | 1.0.44 | **5.71s** | 5.67s - 5.99s | 36,580,207 bytes | 268 bytes | +| Library | Version | Median Build Time | Range | Client Size | Build Size (incl. caches) | CSS Size | +| -------------------------------------- | ------- | ----------------- | ------------- | ----------- | ------------------------- | ----------- | +| tailwindcss | 4.3.5 | 3.91s | 3.65s - 3.94s | n/a | 30,536,946 bytes | 6,196 bytes | +| **devup-ui (direct APIs, single CSS)** | 1.0.44 | **3.85s** | 3.60s - 4.02s | n/a | 28,905,488 bytes | 327 bytes | +| **devup-ui (static `.css.ts`)** | 1.0.44 | **3.91s** | 3.61s - 3.95s | n/a | 28,950,340 bytes | 268 bytes | -The Turbopack ranges do not overlap, so the direct-API median is 0.12s (2.1%) behind Tailwind on this fixture. The 3 cold samples were Tailwind `5.68s, 5.73s, 5.51s`, direct Devup UI `5.77s, 5.79s, 5.87s`, and static `.css.ts` `5.71s, 5.99s, 5.67s`. The fixtures have comparable app shapes, not pixel-identical styling: Tailwind styles the leading paragraph and button more heavily, while Devup UI exercises typed component/style props. Treat these as build-pipeline results rather than a per-rule microbenchmark. Every `.css.ts` module runs on the full Boa evaluator, which adds about 20 ms for the first module and under 1 ms for each further one. CI compares the Devup UI rows with a checked baseline (see `benchmark-gate.js` for the rule) and fails on a regression beyond the measured noise. +The Turbopack ranges overlap, so the direct-API median is 0.05s (1.3%) ahead of Tailwind on this fixture and the two are effectively at parity. The 3 cold samples were Tailwind `3.94s, 3.65s, 3.91s`, direct Devup UI `3.85s, 3.60s, 4.02s`, and static `.css.ts` `3.95s, 3.61s, 3.91s`. The fixtures have comparable app shapes, not pixel-identical styling: Tailwind styles the leading paragraph and button more heavily, while Devup UI exercises typed component/style props. Treat these as build-pipeline results rather than a per-rule microbenchmark. Every `.css.ts` module runs on the full Boa evaluator, which adds about 20 ms for the first module and under 1 ms for each further one. CI compares the Devup UI rows with a checked baseline (see `benchmark-gate.js` for the rule) and fails on a regression beyond the measured noise. ## How it works diff --git a/packages/next-plugin/README.md b/packages/next-plugin/README.md index d6313129d..adb6df322 100644 --- a/packages/next-plugin/README.md +++ b/packages/next-plugin/README.md @@ -75,33 +75,33 @@ npm install @devup-ui/webpack-plugin -[Latest CI benchmark](https://github.com/dev-five-git/devup-ui/actions/runs/37758611477) (commit `467a379a`, Devup UI 1.0.44) on `ubuntu-24.04` with Next.js 16.3.3. Every row is the median of 3 cold builds that ran in rotating order, shown with the range of the samples. All Next.js builds use the native TypeScript 7 CLI for type checking. The English and Korean tables are generated from the same checked result file, `benchmark-results.json`. +[Latest CI benchmark](https://github.com/dev-five-git/devup-ui/actions/runs/43770976836) (commit `c750d33c`, Devup UI 1.0.44, 2026-11-15) on `ubuntu-26.04` with Next.js 16.4.6. Every row is the median of 3 cold builds that ran in rotating order, shown with the range of the samples. All Next.js builds use the native TypeScript 7 CLI for type checking. The English and Korean tables are generated from the same checked result file, `benchmark-results.json`, which CI refreshes after every merge to main and records in `benchmark/history.json`, one entry per commit, so a slower build can be traced to the merge that caused it. -Build Size is every byte of the build output directory (`.next`, or `dist` for vinext), including caches and server output. The checked table retains its original historical CSS measurements, which recursively counted `.css` files throughout that output. New runs count only browser-shipped CSS: `.next/static/**/*.css` (Webpack `static/css` and Turbopack `static/chunks`) or vinext `dist/client/**/*.css`, excluding caches and server CSS. A missing browser-assets directory is an error; an existing directory with no CSS counts zero. Approved CSS measurement corrections are limited to explicitly named `devup-ui`, `devup-ui-single` and `vinext-devup-ui` rows. `bun benchmark-check.js --write-css-baseline devup-ui` retains the per-file mode; `bun benchmark-check.js --write-css-baseline devup-ui-single,vinext-devup-ui` selects only the other two rows in one comma-separated argument. Only selected existing rows' CSS bytes change; unlike `--write-baseline`, this preserves sample count, build bytes, ratios, tolerances, all unselected rows and calibration history. Missing or unsupported names and conflicting writer modes are rejected. +Client Size is the JavaScript and CSS shipped to the browser, uncompressed: `.next/static/**/*.{js,css}` or vinext `dist/client/**/*.{js,css}`. Build Size (incl. caches) is every byte of the build output directory (`.next`, or `dist` for vinext); most of it is the bundler cache and server output, and it moves by a few kilobytes between identical builds, so it is kept for continuity rather than as what users download. CSS Size counts only browser-shipped CSS: `.next/static/**/*.css` (Webpack `static/css` and Turbopack `static/chunks`) or vinext `dist/client/**/*.css`, excluding caches and server CSS. A missing browser-assets directory is an error; an existing directory with no CSS counts zero. Every size is measured on every sample and shown as the median; `benchmark-results.json` keeps the samples with their range, and rows measured before Client Size was recorded show n/a. Approved CSS measurement corrections are limited to explicitly named `devup-ui`, `devup-ui-single` and `vinext-devup-ui` rows. `bun benchmark-check.js --write-css-baseline devup-ui` retains the per-file mode; `bun benchmark-check.js --write-css-baseline devup-ui-single,vinext-devup-ui` selects only the other two rows in one comma-separated argument. Only selected existing rows' CSS bytes change; unlike `--write-baseline`, this preserves sample count, build bytes, ratios, tolerances, all unselected rows and calibration history. Missing or unsupported names and conflicting writer modes are rejected. Webpack: -| Library | Version | Median Build Time | Range | Build Size | CSS Size | -| --------------------------- | ------- | ----------------- | --------------- | ----------------- | ------------ | -| tailwindcss | 4.3.3 | 13.02s | 12.91s - 13.20s | 67,339,250 bytes | 5,852 bytes | -| styleX | 0.19.0 | 29.01s | 28.72s - 29.50s | 96,290,533 bytes | 425 bytes | -| vanilla-extract | 1.21.2 | 12.34s | 12.22s - 12.35s | 68,565,511 bytes | 294 bytes | -| kuma-ui | 1.6.4 | 13.55s | 13.49s - 13.57s | 75,627,429 bytes | 340 bytes | -| panda-css | 1.12.0 | 13.44s | 13.29s - 13.58s | 71,849,243 bytes | 15,615 bytes | -| chakra-ui | 3.37.0 | 20.29s | 19.95s - 21.06s | 207,425,028 bytes | 0 bytes | -| mui | 9.4.0 | 14.12s | 13.78s - 14.26s | 101,476,098 bytes | 0 bytes | -| **devup-ui (per-file CSS)** | 1.0.44 | **10.95s** | 10.87s - 11.09s | 67,427,695 bytes | 562 bytes | -| **devup-ui (single CSS)** | 1.0.44 | **11.04s** | 10.88s - 11.40s | 67,436,336 bytes | 790 bytes | +| Library | Version | Median Build Time | Range | Client Size | Build Size (incl. caches) | CSS Size | +| --------------------------- | ------- | ----------------- | --------------- | ----------- | ------------------------- | ------------ | +| tailwindcss | 4.3.5 | 10.23s | 10.16s - 11.07s | n/a | 69,807,397 bytes | 5,851 bytes | +| styleX | 0.19.2 | 24.33s | 24.04s - 25.58s | n/a | 99,500,267 bytes | 425 bytes | +| vanilla-extract | 1.21.3 | 10.14s | 9.56s - 10.29s | n/a | 70,957,513 bytes | 294 bytes | +| kuma-ui | 1.6.4 | 11.13s | 10.38s - 11.65s | n/a | 77,951,297 bytes | 340 bytes | +| panda-css | 2.5.0 | 11.04s | 10.14s - 11.22s | n/a | 75,860,686 bytes | 21,149 bytes | +| chakra-ui | 3.38.0 | 16.33s | 16.05s - 16.37s | n/a | 211,095,734 bytes | 0 bytes | +| mui | 9.5.0 | 11.33s | 10.65s - 12.03s | n/a | 104,631,987 bytes | 0 bytes | +| **devup-ui (per-file CSS)** | 1.0.44 | **9.11s** | 8.61s - 9.27s | n/a | 69,803,573 bytes | 494 bytes | +| **devup-ui (single CSS)** | 1.0.44 | **9.23s** | 8.65s - 9.31s | n/a | 69,788,823 bytes | 395 bytes | Turbopack: -| Library | Version | Median Build Time | Range | Build Size | CSS Size | -| -------------------------------------- | ------- | ----------------- | ------------- | ---------------- | ----------- | -| tailwindcss | 4.3.3 | 5.68s | 5.51s - 5.73s | 38,440,013 bytes | 6,197 bytes | -| **devup-ui (direct APIs, single CSS)** | 1.0.44 | **5.79s** | 5.77s - 5.87s | 36,538,765 bytes | 327 bytes | -| **devup-ui (static `.css.ts`)** | 1.0.44 | **5.71s** | 5.67s - 5.99s | 36,580,207 bytes | 268 bytes | +| Library | Version | Median Build Time | Range | Client Size | Build Size (incl. caches) | CSS Size | +| -------------------------------------- | ------- | ----------------- | ------------- | ----------- | ------------------------- | ----------- | +| tailwindcss | 4.3.5 | 3.91s | 3.65s - 3.94s | n/a | 30,536,946 bytes | 6,196 bytes | +| **devup-ui (direct APIs, single CSS)** | 1.0.44 | **3.85s** | 3.60s - 4.02s | n/a | 28,905,488 bytes | 327 bytes | +| **devup-ui (static `.css.ts`)** | 1.0.44 | **3.91s** | 3.61s - 3.95s | n/a | 28,950,340 bytes | 268 bytes | -The Turbopack ranges do not overlap, so the direct-API median is 0.12s (2.1%) behind Tailwind on this fixture. The 3 cold samples were Tailwind `5.68s, 5.73s, 5.51s`, direct Devup UI `5.77s, 5.79s, 5.87s`, and static `.css.ts` `5.71s, 5.99s, 5.67s`. The fixtures have comparable app shapes, not pixel-identical styling: Tailwind styles the leading paragraph and button more heavily, while Devup UI exercises typed component/style props. Treat these as build-pipeline results rather than a per-rule microbenchmark. Every `.css.ts` module runs on the full Boa evaluator, which adds about 20 ms for the first module and under 1 ms for each further one. CI compares the Devup UI rows with a checked baseline (see `benchmark-gate.js` for the rule) and fails on a regression beyond the measured noise. +The Turbopack ranges overlap, so the direct-API median is 0.05s (1.3%) ahead of Tailwind on this fixture and the two are effectively at parity. The 3 cold samples were Tailwind `3.94s, 3.65s, 3.91s`, direct Devup UI `3.85s, 3.60s, 4.02s`, and static `.css.ts` `3.95s, 3.61s, 3.91s`. The fixtures have comparable app shapes, not pixel-identical styling: Tailwind styles the leading paragraph and button more heavily, while Devup UI exercises typed component/style props. Treat these as build-pipeline results rather than a per-rule microbenchmark. Every `.css.ts` module runs on the full Boa evaluator, which adds about 20 ms for the first module and under 1 ms for each further one. CI compares the Devup UI rows with a checked baseline (see `benchmark-gate.js` for the rule) and fails on a regression beyond the measured noise. ## How it works diff --git a/packages/plugin-utils/src/__tests__/benchmark-output.test.ts b/packages/plugin-utils/src/__tests__/benchmark-output.test.ts index d6726e9e0..479d1bbe6 100644 --- a/packages/plugin-utils/src/__tests__/benchmark-output.test.ts +++ b/packages/plugin-utils/src/__tests__/benchmark-output.test.ts @@ -35,7 +35,7 @@ describe('benchmark output measurement', () => { const result = measureOutput(directory) - expect(result).toEqual({ bytes: 1196, cssBytes: 494 }) + expect(result).toEqual({ bytes: 1196, cssBytes: 494, clientBytes: 595 }) }, ) @@ -49,7 +49,7 @@ describe('benchmark output measurement', () => { const result = measureOutput(directory) - expect(result).toEqual({ bytes: 299, cssBytes: 48 }) + expect(result).toEqual({ bytes: 299, cssBytes: 48, clientBytes: 149 }) }) it('rejects measurement when neither output directory exists', () => { @@ -79,7 +79,7 @@ describe('benchmark output measurement', () => { const result = measureOutput(directory) - expect(result).toEqual({ bytes: 0, cssBytes: 0 }) + expect(result).toEqual({ bytes: 0, cssBytes: 0, clientBytes: 0 }) }, ) @@ -91,7 +91,7 @@ describe('benchmark output measurement', () => { const result = measureOutput(directory) - expect(result).toEqual({ bytes: 64, cssBytes: 0 }) + expect(result).toEqual({ bytes: 64, cssBytes: 0, clientBytes: 41 }) }, ) diff --git a/packages/plugin-utils/src/__tests__/benchmark-record.test.ts b/packages/plugin-utils/src/__tests__/benchmark-record.test.ts new file mode 100644 index 000000000..6481bf36d --- /dev/null +++ b/packages/plugin-utils/src/__tests__/benchmark-record.test.ts @@ -0,0 +1,548 @@ +import { spawnSync } from 'node:child_process' +import { + existsSync, + mkdtempSync, + readFileSync, + rmSync, + writeFileSync, +} from 'node:fs' +import { tmpdir } from 'node:os' +import { join, resolve } from 'node:path' + +import { afterEach, beforeEach, describe, expect, it } from 'bun:test' + +import storedHistory from '../../../../benchmark/history.json' +import { + addToHistory, + applyRun, + formatJson, + HISTORY_COLUMNS, + HISTORY_LIMIT, + historyEntry, + refreshPlan, + round, + sizeSummary, + summarizeRow, + trend, +} from '../../../../benchmark-record.js' +import storedResults from '../../../../benchmark-results.json' + +const ROOT = resolve(import.meta.dir, '../../../..') +const SHA_A = 'a'.repeat(40) +const SHA_B = 'b'.repeat(40) + +function measured(median: number, extra: Record = {}) { + return { + samples: [median - 0.1, median, median + 0.2], + median, + min: median - 0.1, + max: median + 0.2, + bytes: 1000, + cssBytes: 100, + ...extra, + } +} + +function makeRun(commit: string, rows: Record) { + return { + run: { id: '7', commit, date: '2026-11-15T00:00:00.000Z' }, + samples: 3, + rows, + } +} + +const results = { + run: { + id: '1', + url: 'https://github.com/dev-five-git/devup-ui/actions/runs/1', + commit: 'aaaaaaaa', + sha: SHA_A, + date: '2026-11-01T00:00:00.000Z', + runner: 'ubuntu-24.04', + next: '16.0.0', + devupUi: '1.0.0', + }, + samples: 3, + rows: [ + { + table: 'webpack', + target: 'tailwind', + label: 'tailwindcss', + version: '4.0.0', + }, + ], +} + +describe('benchmark rows', () => { + it('rounds seconds to the millisecond', () => { + expect(round(10.23456)).toBe(10.235) + }) + + it('summarizes a size measured on every sample', () => { + expect(sizeSummary([3, 1, 2])).toEqual({ + samples: [3, 1, 2], + median: 2, + min: 1, + max: 3, + }) + }) + + it('reports the median of every measurement and keeps the size samples', () => { + const row = summarizeRow({ + seconds: [3, 1, 2], + bytes: [10, 12, 11], + cssBytes: [5, 5, 5], + clientBytes: [40, 41, 39], + }) + + expect(row).toEqual({ + samples: [3, 1, 2], + median: 2, + min: 1, + max: 3, + bytes: 11, + cssBytes: 5, + clientBytes: 40, + sizes: { + bytes: { samples: [10, 12, 11], median: 11, min: 10, max: 12 }, + cssBytes: { samples: [5, 5, 5], median: 5, min: 5, max: 5 }, + clientBytes: { samples: [40, 41, 39], median: 40, min: 39, max: 41 }, + }, + }) + }) +}) + +describe('benchmark results', () => { + it('takes the run, its metadata and every measurement of the table rows', () => { + const sizes = { bytes: sizeSummary([1000, 1000, 1000]) } + const run = { + run: { + id: '9', + commit: SHA_B, + date: '2026-11-15T00:00:00.000Z', + runner: 'ubuntu-26.04', + next: '16.4.6', + devupUi: '1.0.45', + }, + samples: 3, + rows: { + tailwind: measured(10.23456, { + clientBytes: 500, + sizes, + version: '4.3.5', + }), + unused: measured(1), + }, + } + + expect(applyRun(results, run)).toEqual({ + run: { + id: '9', + url: 'https://github.com/dev-five-git/devup-ui/actions/runs/9', + commit: 'bbbbbbbb', + sha: SHA_B, + date: '2026-11-15T00:00:00.000Z', + runner: 'ubuntu-26.04', + next: '16.4.6', + devupUi: '1.0.45', + }, + samples: 3, + rows: [ + { + table: 'webpack', + target: 'tailwind', + label: 'tailwindcss', + version: '4.3.5', + samples: [10.135, 10.235, 10.435], + median: 10.235, + min: 10.135, + max: 10.435, + bytes: 1000, + cssBytes: 100, + clientBytes: 500, + sizes, + }, + ], + }) + }) + + it('keeps what an older run did not record', () => { + const run = { + run: { id: null, commit: null }, + samples: 3, + rows: { tailwind: measured(10) }, + } + + const next = applyRun(results, run) + + expect(next.run).toEqual(results.run) + expect(next.rows[0]).toMatchObject({ + version: '4.0.0', + clientBytes: null, + sizes: null, + }) + }) + + it('rejects a run without a row of the tables', () => { + expect(() => applyRun(results, makeRun(SHA_B, {}))).toThrow( + 'the run has no tailwind row for the tables', + ) + }) + + it('keeps the checked results in the shape the README and landing read', () => { + expect(storedResults.run.sha).toStartWith(storedResults.run.commit) + expect(storedResults.run.url).toEndWith(storedResults.run.id) + for (const row of storedResults.rows) { + expect(row.min).toBeLessThanOrEqual(row.median) + expect(row.median).toBeLessThanOrEqual(row.max) + expect(row.bytes).toBeGreaterThan(0) + } + }) +}) + +describe('benchmark history', () => { + const baseline = { + samples: 3, + rows: { + 'devup-ui': { + control: 'tailwind', + ratio: 0.9, + timeTolerance: 0.1, + bytes: 1000, + cssBytes: 100, + }, + }, + } + + it('records every row and the gate verdict of a run', () => { + const run = makeRun(SHA_A, { + tailwind: measured(10, { clientBytes: 50 }), + 'devup-ui': measured(9.12345), + }) + + expect(historyEntry(run, baseline, '2026-11-14T00:00:00.000Z')).toEqual({ + sha: SHA_A, + run: '7', + committedAt: '2026-11-14T00:00:00.000Z', + measuredAt: '2026-11-15T00:00:00.000Z', + devupUi: null, + samples: 3, + gate: 'pass', + regressions: [], + rows: { + tailwind: [10, 9.9, 10.2, 1000, 100, 50], + 'devup-ui': [9.123, 9.023, 9.323, 1000, 100, null], + }, + }) + }) + + it('names the rows the gate failed', () => { + const run = { + ...makeRun(SHA_A, { + tailwind: measured(10), + 'devup-ui': measured(12), + }), + run: { id: '7', commit: SHA_A, devupUi: '1.0.45' }, + } + + const entry = historyEntry(run, baseline, '2026-11-14T00:00:00.000Z') + + expect(entry).toMatchObject({ + gate: 'fail', + regressions: ['devup-ui'], + measuredAt: null, + devupUi: '1.0.45', + }) + }) + + const entry = (sha: string, committedAt: string) => ({ + sha, + committedAt, + rows: {}, + }) + + it('starts a history and keeps it in commit order', () => { + const first = addToHistory(undefined, entry('b', '2026-11-02')) + const second = addToHistory(first, entry('a', '2026-11-01')) + + expect(second).toEqual({ + columns: HISTORY_COLUMNS, + entries: [entry('a', '2026-11-01'), entry('b', '2026-11-02')], + }) + }) + + it('replaces the entry of a re-run commit', () => { + const history = addToHistory(undefined, entry('a', '2026-11-01')) + const rerun = { ...entry('a', '2026-11-01'), run: 'again' } + + expect(addToHistory(history, rerun).entries).toEqual([rerun]) + }) + + it('keeps only the latest entries', () => { + let history = addToHistory(undefined, entry('a', '2026-11-01')) + history = addToHistory(history, entry('b', '2026-11-02'), 1) + + expect(history.entries).toEqual([entry('b', '2026-11-02')]) + expect(HISTORY_LIMIT).toBeGreaterThan(100) + }) + + it('keeps the checked history in the shape the refresh writes', () => { + expect(storedHistory.columns).toEqual(HISTORY_COLUMNS) + expect(storedHistory.entries.map((kept) => kept.sha)).toContain( + storedResults.run.sha, + ) + for (const kept of storedHistory.entries) + for (const row of Object.values(kept.rows)) + expect(row).toHaveLength(HISTORY_COLUMNS.length) + }) + + it('prints the trend of a row against its control', () => { + const history = { + entries: [ + { + sha: SHA_A, + committedAt: '2026-11-01', + gate: 'pass', + rows: { + tailwind: [10, 9, 11, 1000, 100, null], + 'devup-ui': [9, 8, 10, 900, 50, 400], + }, + }, + { + sha: SHA_B, + committedAt: '2026-11-02', + gate: 'fail', + rows: { 'devup-ui': [12, 11, 13, 900, 50, null] }, + }, + { sha: 'c'.repeat(40), committedAt: '2026-11-03', rows: {} }, + ], + } + + expect(trend(history, 'devup-ui', 'tailwind')).toBe( + [ + 'aaaaaaaa 2026-11-01 pass 9.00s 0.900x tailwind, 900 bytes, css 50, client 400', + 'bbbbbbbb 2026-11-02 fail 12.00s, 900 bytes, css 50', + ].join('\n'), + ) + }) +}) + +describe('benchmark refresh order', () => { + const ancestry = + (pairs: Record) => (a: string, b: string) => + pairs[`${a}>${b}`] ?? null + + it('skips a commit that is not on main', () => { + expect( + refreshPlan( + { measured: 'x', head: 'h', published: 'p' }, + ancestry({ 'x>h': false }), + ), + ).toEqual({ history: false, results: false, reason: 'not on main' }) + }) + + it('records but does not publish a commit older than the published one', () => { + expect( + refreshPlan( + { measured: 'x', head: 'h', published: SHA_B }, + ancestry({ 'x>h': true, [`${SHA_B}>x`]: false }), + ), + ).toEqual({ + history: true, + results: false, + reason: 'the published results come from a later commit (bbbbbbbb)', + }) + }) + + it.each([ + ['a newer commit', SHA_A, true], + ['an unknown published commit', SHA_A, null], + ['no published commit', undefined, null], + ])('publishes %s', (_, published, answer) => { + expect( + refreshPlan( + { measured: 'x', head: 'h', published }, + ancestry({ 'x>h': true, [`${published}>x`]: answer }), + ), + ).toEqual({ + history: true, + results: true, + reason: 'newer or the same commit', + }) + }) +}) + +describe('benchmark JSON', () => { + it('prints short arrays on one line and long ones one item per line', () => { + const long = Array.from({ length: 12 }, (_, index) => 1_000_000 + index) + + expect( + formatJson({ short: [1, 2.5, null], names: ['a', 'b'], long, empty: [] }), + ).toBe( + [ + '{', + ' "short": [1, 2.5, null],', + ' "names": ["a", "b"],', + ' "long": [', + ...long.map( + (value, index) => + ` ${value}${index === long.length - 1 ? '' : ','}`, + ), + ' ],', + ' "empty": []', + '}', + '', + ].join('\n'), + ) + }) + + it('formats the checked files exactly as it writes them', () => { + for (const file of ['benchmark-results.json', 'benchmark/history.json']) { + const text = readFileSync(join(ROOT, file), 'utf8').replaceAll( + '\r\n', + '\n', + ) + expect(formatJson(JSON.parse(text))).toBe(text) + } + }) +}) + +describe('benchmark refresh CLI', () => { + let directory: string + + const git = (...args: string[]) => + spawnSync( + 'git', + ['-c', 'user.name=test', '-c', 'user.email=test@test', ...args], + { cwd: directory, encoding: 'utf8' }, + ).stdout.trim() + const commit = (message: string, date: string) => { + spawnSync( + 'git', + [ + '-c', + 'user.name=test', + '-c', + 'user.email=test@test', + 'commit', + '--allow-empty', + '-q', + '-m', + message, + ], + { + cwd: directory, + env: { + ...process.env, + GIT_COMMITTER_DATE: date, + GIT_AUTHOR_DATE: date, + }, + }, + ) + return git('rev-parse', 'HEAD') + } + const write = (file: string, value: unknown) => + writeFileSync(join(directory, file), JSON.stringify(value)) + const read = (file: string) => + JSON.parse(readFileSync(join(directory, file), 'utf8')) + const refresh = (...args: string[]) => + spawnSync(process.execPath, [join(ROOT, 'benchmark-refresh.js'), ...args], { + cwd: directory, + encoding: 'utf8', + timeout: 20_000, + }) + + let first: string + let second: string + + beforeEach(() => { + directory = mkdtempSync(join(tmpdir(), 'devup-benchmark-refresh-')) + git('init', '-q') + write('benchmark-baseline.json', { samples: 3, rows: {} }) + git('add', '.') + first = commit('first', '2026-11-01T00:00:00Z') + second = commit('second', '2026-11-02T00:00:00Z') + write('benchmark-manifest.json', { + targets: [{ name: 'tailwind', group: 'webpack' }], + controls: { webpack: 'tailwind' }, + }) + }) + + afterEach(() => { + rmSync(directory, { recursive: true, force: true }) + }) + + it('publishes and records a newer commit, then prints its trend', () => { + write('benchmark-results.json', results) + write('benchmark-run.json', makeRun(second, { tailwind: measured(10) })) + + const result = refresh() + + expect(result.status).toBe(0) + expect(read('benchmark-results.json').run.sha).toBe(second) + expect(read('benchmark/history.json').entries).toMatchObject([ + { sha: second, committedAt: '2026-11-02T00:00:00.000Z', gate: 'pass' }, + ]) + + const printed = refresh('--trend', 'tailwind') + expect(printed.status).toBe(0) + expect(printed.stdout).toContain( + `${second.slice(0, 8)} 2026-11-02T00:00:00.000Z pass 10.00s 1.000x tailwind`, + ) + }) + + it('records an older commit without replacing the published results', () => { + write('benchmark-results.json', { + ...results, + run: { ...results.run, sha: second }, + }) + write('benchmark-run.json', makeRun(first, { tailwind: measured(10) })) + + const result = refresh() + + expect(result.status).toBe(0) + expect(read('benchmark-results.json').run.sha).toBe(second) + expect(read('benchmark/history.json').entries).toMatchObject([ + { sha: first }, + ]) + }) + + it('falls back to the checked baseline when the commit has none', () => { + rmSync(join(directory, 'benchmark-baseline.json')) + git('rm', '-q', '--cached', 'benchmark-baseline.json') + const third = commit('third', '2026-11-03T00:00:00Z') + write('benchmark-baseline.json', { samples: 3, rows: {} }) + write('benchmark-results.json', results) + write('benchmark-run.json', makeRun(third, { tailwind: measured(10) })) + + const result = refresh() + + expect(result.status).toBe(0) + expect(read('benchmark/history.json').entries).toHaveLength(1) + }) + + it('leaves everything alone for a commit that is not on main', () => { + write('benchmark-results.json', results) + write('benchmark-run.json', makeRun(SHA_B, { tailwind: measured(10) })) + + const result = refresh() + + expect(result.status).toBe(0) + expect(result.stdout).toContain('not on main') + expect(existsSync(join(directory, 'benchmark/history.json'))).toBe(false) + expect(read('benchmark-results.json')).toEqual(results) + }) + + it.each([ + [['--trend', 'missing'], 'benchmark-manifest.json has no missing'], + [[], 'benchmark-run.json names no commit'], + ])('rejects %p', (args, message) => { + write('benchmark-results.json', results) + write('benchmark-run.json', makeRun('', {})) + + const result = refresh(...args) + + expect(result.status).not.toBe(0) + expect(result.stderr).toContain(message) + }) +}) diff --git a/packages/react/README.md b/packages/react/README.md index be49ae865..25d4ce505 100644 --- a/packages/react/README.md +++ b/packages/react/README.md @@ -75,33 +75,33 @@ npm install @devup-ui/webpack-plugin -[Latest CI benchmark](https://github.com/dev-five-git/devup-ui/actions/runs/37758611477) (commit `467a379a`, Devup UI 1.0.44) on `ubuntu-24.04` with Next.js 16.3.3. Every row is the median of 3 cold builds that ran in rotating order, shown with the range of the samples. All Next.js builds use the native TypeScript 7 CLI for type checking. The English and Korean tables are generated from the same checked result file, `benchmark-results.json`. +[Latest CI benchmark](https://github.com/dev-five-git/devup-ui/actions/runs/43770976836) (commit `c750d33c`, Devup UI 1.0.44, 2026-11-15) on `ubuntu-26.04` with Next.js 16.4.6. Every row is the median of 3 cold builds that ran in rotating order, shown with the range of the samples. All Next.js builds use the native TypeScript 7 CLI for type checking. The English and Korean tables are generated from the same checked result file, `benchmark-results.json`, which CI refreshes after every merge to main and records in `benchmark/history.json`, one entry per commit, so a slower build can be traced to the merge that caused it. -Build Size is every byte of the build output directory (`.next`, or `dist` for vinext), including caches and server output. The checked table retains its original historical CSS measurements, which recursively counted `.css` files throughout that output. New runs count only browser-shipped CSS: `.next/static/**/*.css` (Webpack `static/css` and Turbopack `static/chunks`) or vinext `dist/client/**/*.css`, excluding caches and server CSS. A missing browser-assets directory is an error; an existing directory with no CSS counts zero. Approved CSS measurement corrections are limited to explicitly named `devup-ui`, `devup-ui-single` and `vinext-devup-ui` rows. `bun benchmark-check.js --write-css-baseline devup-ui` retains the per-file mode; `bun benchmark-check.js --write-css-baseline devup-ui-single,vinext-devup-ui` selects only the other two rows in one comma-separated argument. Only selected existing rows' CSS bytes change; unlike `--write-baseline`, this preserves sample count, build bytes, ratios, tolerances, all unselected rows and calibration history. Missing or unsupported names and conflicting writer modes are rejected. +Client Size is the JavaScript and CSS shipped to the browser, uncompressed: `.next/static/**/*.{js,css}` or vinext `dist/client/**/*.{js,css}`. Build Size (incl. caches) is every byte of the build output directory (`.next`, or `dist` for vinext); most of it is the bundler cache and server output, and it moves by a few kilobytes between identical builds, so it is kept for continuity rather than as what users download. CSS Size counts only browser-shipped CSS: `.next/static/**/*.css` (Webpack `static/css` and Turbopack `static/chunks`) or vinext `dist/client/**/*.css`, excluding caches and server CSS. A missing browser-assets directory is an error; an existing directory with no CSS counts zero. Every size is measured on every sample and shown as the median; `benchmark-results.json` keeps the samples with their range, and rows measured before Client Size was recorded show n/a. Approved CSS measurement corrections are limited to explicitly named `devup-ui`, `devup-ui-single` and `vinext-devup-ui` rows. `bun benchmark-check.js --write-css-baseline devup-ui` retains the per-file mode; `bun benchmark-check.js --write-css-baseline devup-ui-single,vinext-devup-ui` selects only the other two rows in one comma-separated argument. Only selected existing rows' CSS bytes change; unlike `--write-baseline`, this preserves sample count, build bytes, ratios, tolerances, all unselected rows and calibration history. Missing or unsupported names and conflicting writer modes are rejected. Webpack: -| Library | Version | Median Build Time | Range | Build Size | CSS Size | -| --------------------------- | ------- | ----------------- | --------------- | ----------------- | ------------ | -| tailwindcss | 4.3.3 | 13.02s | 12.91s - 13.20s | 67,339,250 bytes | 5,852 bytes | -| styleX | 0.19.0 | 29.01s | 28.72s - 29.50s | 96,290,533 bytes | 425 bytes | -| vanilla-extract | 1.21.2 | 12.34s | 12.22s - 12.35s | 68,565,511 bytes | 294 bytes | -| kuma-ui | 1.6.4 | 13.55s | 13.49s - 13.57s | 75,627,429 bytes | 340 bytes | -| panda-css | 1.12.0 | 13.44s | 13.29s - 13.58s | 71,849,243 bytes | 15,615 bytes | -| chakra-ui | 3.37.0 | 20.29s | 19.95s - 21.06s | 207,425,028 bytes | 0 bytes | -| mui | 9.4.0 | 14.12s | 13.78s - 14.26s | 101,476,098 bytes | 0 bytes | -| **devup-ui (per-file CSS)** | 1.0.44 | **10.95s** | 10.87s - 11.09s | 67,427,695 bytes | 562 bytes | -| **devup-ui (single CSS)** | 1.0.44 | **11.04s** | 10.88s - 11.40s | 67,436,336 bytes | 790 bytes | +| Library | Version | Median Build Time | Range | Client Size | Build Size (incl. caches) | CSS Size | +| --------------------------- | ------- | ----------------- | --------------- | ----------- | ------------------------- | ------------ | +| tailwindcss | 4.3.5 | 10.23s | 10.16s - 11.07s | n/a | 69,807,397 bytes | 5,851 bytes | +| styleX | 0.19.2 | 24.33s | 24.04s - 25.58s | n/a | 99,500,267 bytes | 425 bytes | +| vanilla-extract | 1.21.3 | 10.14s | 9.56s - 10.29s | n/a | 70,957,513 bytes | 294 bytes | +| kuma-ui | 1.6.4 | 11.13s | 10.38s - 11.65s | n/a | 77,951,297 bytes | 340 bytes | +| panda-css | 2.5.0 | 11.04s | 10.14s - 11.22s | n/a | 75,860,686 bytes | 21,149 bytes | +| chakra-ui | 3.38.0 | 16.33s | 16.05s - 16.37s | n/a | 211,095,734 bytes | 0 bytes | +| mui | 9.5.0 | 11.33s | 10.65s - 12.03s | n/a | 104,631,987 bytes | 0 bytes | +| **devup-ui (per-file CSS)** | 1.0.44 | **9.11s** | 8.61s - 9.27s | n/a | 69,803,573 bytes | 494 bytes | +| **devup-ui (single CSS)** | 1.0.44 | **9.23s** | 8.65s - 9.31s | n/a | 69,788,823 bytes | 395 bytes | Turbopack: -| Library | Version | Median Build Time | Range | Build Size | CSS Size | -| -------------------------------------- | ------- | ----------------- | ------------- | ---------------- | ----------- | -| tailwindcss | 4.3.3 | 5.68s | 5.51s - 5.73s | 38,440,013 bytes | 6,197 bytes | -| **devup-ui (direct APIs, single CSS)** | 1.0.44 | **5.79s** | 5.77s - 5.87s | 36,538,765 bytes | 327 bytes | -| **devup-ui (static `.css.ts`)** | 1.0.44 | **5.71s** | 5.67s - 5.99s | 36,580,207 bytes | 268 bytes | +| Library | Version | Median Build Time | Range | Client Size | Build Size (incl. caches) | CSS Size | +| -------------------------------------- | ------- | ----------------- | ------------- | ----------- | ------------------------- | ----------- | +| tailwindcss | 4.3.5 | 3.91s | 3.65s - 3.94s | n/a | 30,536,946 bytes | 6,196 bytes | +| **devup-ui (direct APIs, single CSS)** | 1.0.44 | **3.85s** | 3.60s - 4.02s | n/a | 28,905,488 bytes | 327 bytes | +| **devup-ui (static `.css.ts`)** | 1.0.44 | **3.91s** | 3.61s - 3.95s | n/a | 28,950,340 bytes | 268 bytes | -The Turbopack ranges do not overlap, so the direct-API median is 0.12s (2.1%) behind Tailwind on this fixture. The 3 cold samples were Tailwind `5.68s, 5.73s, 5.51s`, direct Devup UI `5.77s, 5.79s, 5.87s`, and static `.css.ts` `5.71s, 5.99s, 5.67s`. The fixtures have comparable app shapes, not pixel-identical styling: Tailwind styles the leading paragraph and button more heavily, while Devup UI exercises typed component/style props. Treat these as build-pipeline results rather than a per-rule microbenchmark. Every `.css.ts` module runs on the full Boa evaluator, which adds about 20 ms for the first module and under 1 ms for each further one. CI compares the Devup UI rows with a checked baseline (see `benchmark-gate.js` for the rule) and fails on a regression beyond the measured noise. +The Turbopack ranges overlap, so the direct-API median is 0.05s (1.3%) ahead of Tailwind on this fixture and the two are effectively at parity. The 3 cold samples were Tailwind `3.94s, 3.65s, 3.91s`, direct Devup UI `3.85s, 3.60s, 4.02s`, and static `.css.ts` `3.95s, 3.61s, 3.91s`. The fixtures have comparable app shapes, not pixel-identical styling: Tailwind styles the leading paragraph and button more heavily, while Devup UI exercises typed component/style props. Treat these as build-pipeline results rather than a per-rule microbenchmark. Every `.css.ts` module runs on the full Boa evaluator, which adds about 20 ms for the first module and under 1 ms for each further one. CI compares the Devup UI rows with a checked baseline (see `benchmark-gate.js` for the rule) and fails on a regression beyond the measured noise. ## How it works diff --git a/packages/reset-css/README.md b/packages/reset-css/README.md index bbdc47a74..d6e6c195a 100644 --- a/packages/reset-css/README.md +++ b/packages/reset-css/README.md @@ -92,33 +92,33 @@ in `:where()`, so your own styles override them. -[Latest CI benchmark](https://github.com/dev-five-git/devup-ui/actions/runs/37758611477) (commit `467a379a`, Devup UI 1.0.44) on `ubuntu-24.04` with Next.js 16.3.3. Every row is the median of 3 cold builds that ran in rotating order, shown with the range of the samples. All Next.js builds use the native TypeScript 7 CLI for type checking. The English and Korean tables are generated from the same checked result file, `benchmark-results.json`. +[Latest CI benchmark](https://github.com/dev-five-git/devup-ui/actions/runs/43770976836) (commit `c750d33c`, Devup UI 1.0.44, 2026-11-15) on `ubuntu-26.04` with Next.js 16.4.6. Every row is the median of 3 cold builds that ran in rotating order, shown with the range of the samples. All Next.js builds use the native TypeScript 7 CLI for type checking. The English and Korean tables are generated from the same checked result file, `benchmark-results.json`, which CI refreshes after every merge to main and records in `benchmark/history.json`, one entry per commit, so a slower build can be traced to the merge that caused it. -Build Size is every byte of the build output directory (`.next`, or `dist` for vinext), including caches and server output. The checked table retains its original historical CSS measurements, which recursively counted `.css` files throughout that output. New runs count only browser-shipped CSS: `.next/static/**/*.css` (Webpack `static/css` and Turbopack `static/chunks`) or vinext `dist/client/**/*.css`, excluding caches and server CSS. A missing browser-assets directory is an error; an existing directory with no CSS counts zero. Approved CSS measurement corrections are limited to explicitly named `devup-ui`, `devup-ui-single` and `vinext-devup-ui` rows. `bun benchmark-check.js --write-css-baseline devup-ui` retains the per-file mode; `bun benchmark-check.js --write-css-baseline devup-ui-single,vinext-devup-ui` selects only the other two rows in one comma-separated argument. Only selected existing rows' CSS bytes change; unlike `--write-baseline`, this preserves sample count, build bytes, ratios, tolerances, all unselected rows and calibration history. Missing or unsupported names and conflicting writer modes are rejected. +Client Size is the JavaScript and CSS shipped to the browser, uncompressed: `.next/static/**/*.{js,css}` or vinext `dist/client/**/*.{js,css}`. Build Size (incl. caches) is every byte of the build output directory (`.next`, or `dist` for vinext); most of it is the bundler cache and server output, and it moves by a few kilobytes between identical builds, so it is kept for continuity rather than as what users download. CSS Size counts only browser-shipped CSS: `.next/static/**/*.css` (Webpack `static/css` and Turbopack `static/chunks`) or vinext `dist/client/**/*.css`, excluding caches and server CSS. A missing browser-assets directory is an error; an existing directory with no CSS counts zero. Every size is measured on every sample and shown as the median; `benchmark-results.json` keeps the samples with their range, and rows measured before Client Size was recorded show n/a. Approved CSS measurement corrections are limited to explicitly named `devup-ui`, `devup-ui-single` and `vinext-devup-ui` rows. `bun benchmark-check.js --write-css-baseline devup-ui` retains the per-file mode; `bun benchmark-check.js --write-css-baseline devup-ui-single,vinext-devup-ui` selects only the other two rows in one comma-separated argument. Only selected existing rows' CSS bytes change; unlike `--write-baseline`, this preserves sample count, build bytes, ratios, tolerances, all unselected rows and calibration history. Missing or unsupported names and conflicting writer modes are rejected. Webpack: -| Library | Version | Median Build Time | Range | Build Size | CSS Size | -| --------------------------- | ------- | ----------------- | --------------- | ----------------- | ------------ | -| tailwindcss | 4.3.3 | 13.02s | 12.91s - 13.20s | 67,339,250 bytes | 5,852 bytes | -| styleX | 0.19.0 | 29.01s | 28.72s - 29.50s | 96,290,533 bytes | 425 bytes | -| vanilla-extract | 1.21.2 | 12.34s | 12.22s - 12.35s | 68,565,511 bytes | 294 bytes | -| kuma-ui | 1.6.4 | 13.55s | 13.49s - 13.57s | 75,627,429 bytes | 340 bytes | -| panda-css | 1.12.0 | 13.44s | 13.29s - 13.58s | 71,849,243 bytes | 15,615 bytes | -| chakra-ui | 3.37.0 | 20.29s | 19.95s - 21.06s | 207,425,028 bytes | 0 bytes | -| mui | 9.4.0 | 14.12s | 13.78s - 14.26s | 101,476,098 bytes | 0 bytes | -| **devup-ui (per-file CSS)** | 1.0.44 | **10.95s** | 10.87s - 11.09s | 67,427,695 bytes | 562 bytes | -| **devup-ui (single CSS)** | 1.0.44 | **11.04s** | 10.88s - 11.40s | 67,436,336 bytes | 790 bytes | +| Library | Version | Median Build Time | Range | Client Size | Build Size (incl. caches) | CSS Size | +| --------------------------- | ------- | ----------------- | --------------- | ----------- | ------------------------- | ------------ | +| tailwindcss | 4.3.5 | 10.23s | 10.16s - 11.07s | n/a | 69,807,397 bytes | 5,851 bytes | +| styleX | 0.19.2 | 24.33s | 24.04s - 25.58s | n/a | 99,500,267 bytes | 425 bytes | +| vanilla-extract | 1.21.3 | 10.14s | 9.56s - 10.29s | n/a | 70,957,513 bytes | 294 bytes | +| kuma-ui | 1.6.4 | 11.13s | 10.38s - 11.65s | n/a | 77,951,297 bytes | 340 bytes | +| panda-css | 2.5.0 | 11.04s | 10.14s - 11.22s | n/a | 75,860,686 bytes | 21,149 bytes | +| chakra-ui | 3.38.0 | 16.33s | 16.05s - 16.37s | n/a | 211,095,734 bytes | 0 bytes | +| mui | 9.5.0 | 11.33s | 10.65s - 12.03s | n/a | 104,631,987 bytes | 0 bytes | +| **devup-ui (per-file CSS)** | 1.0.44 | **9.11s** | 8.61s - 9.27s | n/a | 69,803,573 bytes | 494 bytes | +| **devup-ui (single CSS)** | 1.0.44 | **9.23s** | 8.65s - 9.31s | n/a | 69,788,823 bytes | 395 bytes | Turbopack: -| Library | Version | Median Build Time | Range | Build Size | CSS Size | -| -------------------------------------- | ------- | ----------------- | ------------- | ---------------- | ----------- | -| tailwindcss | 4.3.3 | 5.68s | 5.51s - 5.73s | 38,440,013 bytes | 6,197 bytes | -| **devup-ui (direct APIs, single CSS)** | 1.0.44 | **5.79s** | 5.77s - 5.87s | 36,538,765 bytes | 327 bytes | -| **devup-ui (static `.css.ts`)** | 1.0.44 | **5.71s** | 5.67s - 5.99s | 36,580,207 bytes | 268 bytes | +| Library | Version | Median Build Time | Range | Client Size | Build Size (incl. caches) | CSS Size | +| -------------------------------------- | ------- | ----------------- | ------------- | ----------- | ------------------------- | ----------- | +| tailwindcss | 4.3.5 | 3.91s | 3.65s - 3.94s | n/a | 30,536,946 bytes | 6,196 bytes | +| **devup-ui (direct APIs, single CSS)** | 1.0.44 | **3.85s** | 3.60s - 4.02s | n/a | 28,905,488 bytes | 327 bytes | +| **devup-ui (static `.css.ts`)** | 1.0.44 | **3.91s** | 3.61s - 3.95s | n/a | 28,950,340 bytes | 268 bytes | -The Turbopack ranges do not overlap, so the direct-API median is 0.12s (2.1%) behind Tailwind on this fixture. The 3 cold samples were Tailwind `5.68s, 5.73s, 5.51s`, direct Devup UI `5.77s, 5.79s, 5.87s`, and static `.css.ts` `5.71s, 5.99s, 5.67s`. The fixtures have comparable app shapes, not pixel-identical styling: Tailwind styles the leading paragraph and button more heavily, while Devup UI exercises typed component/style props. Treat these as build-pipeline results rather than a per-rule microbenchmark. Every `.css.ts` module runs on the full Boa evaluator, which adds about 20 ms for the first module and under 1 ms for each further one. CI compares the Devup UI rows with a checked baseline (see `benchmark-gate.js` for the rule) and fails on a regression beyond the measured noise. +The Turbopack ranges overlap, so the direct-API median is 0.05s (1.3%) ahead of Tailwind on this fixture and the two are effectively at parity. The 3 cold samples were Tailwind `3.94s, 3.65s, 3.91s`, direct Devup UI `3.85s, 3.60s, 4.02s`, and static `.css.ts` `3.95s, 3.61s, 3.91s`. The fixtures have comparable app shapes, not pixel-identical styling: Tailwind styles the leading paragraph and button more heavily, while Devup UI exercises typed component/style props. Treat these as build-pipeline results rather than a per-rule microbenchmark. Every `.css.ts` module runs on the full Boa evaluator, which adds about 20 ms for the first module and under 1 ms for each further one. CI compares the Devup UI rows with a checked baseline (see `benchmark-gate.js` for the rule) and fails on a regression beyond the measured noise. ## How it works diff --git a/packages/rsbuild-plugin/README.md b/packages/rsbuild-plugin/README.md index 24cd3f9c7..a2ca3864c 100644 --- a/packages/rsbuild-plugin/README.md +++ b/packages/rsbuild-plugin/README.md @@ -75,33 +75,33 @@ npm install @devup-ui/webpack-plugin -[Latest CI benchmark](https://github.com/dev-five-git/devup-ui/actions/runs/37758611477) (commit `467a379a`, Devup UI 1.0.44) on `ubuntu-24.04` with Next.js 16.3.3. Every row is the median of 3 cold builds that ran in rotating order, shown with the range of the samples. All Next.js builds use the native TypeScript 7 CLI for type checking. The English and Korean tables are generated from the same checked result file, `benchmark-results.json`. +[Latest CI benchmark](https://github.com/dev-five-git/devup-ui/actions/runs/43770976836) (commit `c750d33c`, Devup UI 1.0.44, 2026-11-15) on `ubuntu-26.04` with Next.js 16.4.6. Every row is the median of 3 cold builds that ran in rotating order, shown with the range of the samples. All Next.js builds use the native TypeScript 7 CLI for type checking. The English and Korean tables are generated from the same checked result file, `benchmark-results.json`, which CI refreshes after every merge to main and records in `benchmark/history.json`, one entry per commit, so a slower build can be traced to the merge that caused it. -Build Size is every byte of the build output directory (`.next`, or `dist` for vinext), including caches and server output. The checked table retains its original historical CSS measurements, which recursively counted `.css` files throughout that output. New runs count only browser-shipped CSS: `.next/static/**/*.css` (Webpack `static/css` and Turbopack `static/chunks`) or vinext `dist/client/**/*.css`, excluding caches and server CSS. A missing browser-assets directory is an error; an existing directory with no CSS counts zero. Approved CSS measurement corrections are limited to explicitly named `devup-ui`, `devup-ui-single` and `vinext-devup-ui` rows. `bun benchmark-check.js --write-css-baseline devup-ui` retains the per-file mode; `bun benchmark-check.js --write-css-baseline devup-ui-single,vinext-devup-ui` selects only the other two rows in one comma-separated argument. Only selected existing rows' CSS bytes change; unlike `--write-baseline`, this preserves sample count, build bytes, ratios, tolerances, all unselected rows and calibration history. Missing or unsupported names and conflicting writer modes are rejected. +Client Size is the JavaScript and CSS shipped to the browser, uncompressed: `.next/static/**/*.{js,css}` or vinext `dist/client/**/*.{js,css}`. Build Size (incl. caches) is every byte of the build output directory (`.next`, or `dist` for vinext); most of it is the bundler cache and server output, and it moves by a few kilobytes between identical builds, so it is kept for continuity rather than as what users download. CSS Size counts only browser-shipped CSS: `.next/static/**/*.css` (Webpack `static/css` and Turbopack `static/chunks`) or vinext `dist/client/**/*.css`, excluding caches and server CSS. A missing browser-assets directory is an error; an existing directory with no CSS counts zero. Every size is measured on every sample and shown as the median; `benchmark-results.json` keeps the samples with their range, and rows measured before Client Size was recorded show n/a. Approved CSS measurement corrections are limited to explicitly named `devup-ui`, `devup-ui-single` and `vinext-devup-ui` rows. `bun benchmark-check.js --write-css-baseline devup-ui` retains the per-file mode; `bun benchmark-check.js --write-css-baseline devup-ui-single,vinext-devup-ui` selects only the other two rows in one comma-separated argument. Only selected existing rows' CSS bytes change; unlike `--write-baseline`, this preserves sample count, build bytes, ratios, tolerances, all unselected rows and calibration history. Missing or unsupported names and conflicting writer modes are rejected. Webpack: -| Library | Version | Median Build Time | Range | Build Size | CSS Size | -| --------------------------- | ------- | ----------------- | --------------- | ----------------- | ------------ | -| tailwindcss | 4.3.3 | 13.02s | 12.91s - 13.20s | 67,339,250 bytes | 5,852 bytes | -| styleX | 0.19.0 | 29.01s | 28.72s - 29.50s | 96,290,533 bytes | 425 bytes | -| vanilla-extract | 1.21.2 | 12.34s | 12.22s - 12.35s | 68,565,511 bytes | 294 bytes | -| kuma-ui | 1.6.4 | 13.55s | 13.49s - 13.57s | 75,627,429 bytes | 340 bytes | -| panda-css | 1.12.0 | 13.44s | 13.29s - 13.58s | 71,849,243 bytes | 15,615 bytes | -| chakra-ui | 3.37.0 | 20.29s | 19.95s - 21.06s | 207,425,028 bytes | 0 bytes | -| mui | 9.4.0 | 14.12s | 13.78s - 14.26s | 101,476,098 bytes | 0 bytes | -| **devup-ui (per-file CSS)** | 1.0.44 | **10.95s** | 10.87s - 11.09s | 67,427,695 bytes | 562 bytes | -| **devup-ui (single CSS)** | 1.0.44 | **11.04s** | 10.88s - 11.40s | 67,436,336 bytes | 790 bytes | +| Library | Version | Median Build Time | Range | Client Size | Build Size (incl. caches) | CSS Size | +| --------------------------- | ------- | ----------------- | --------------- | ----------- | ------------------------- | ------------ | +| tailwindcss | 4.3.5 | 10.23s | 10.16s - 11.07s | n/a | 69,807,397 bytes | 5,851 bytes | +| styleX | 0.19.2 | 24.33s | 24.04s - 25.58s | n/a | 99,500,267 bytes | 425 bytes | +| vanilla-extract | 1.21.3 | 10.14s | 9.56s - 10.29s | n/a | 70,957,513 bytes | 294 bytes | +| kuma-ui | 1.6.4 | 11.13s | 10.38s - 11.65s | n/a | 77,951,297 bytes | 340 bytes | +| panda-css | 2.5.0 | 11.04s | 10.14s - 11.22s | n/a | 75,860,686 bytes | 21,149 bytes | +| chakra-ui | 3.38.0 | 16.33s | 16.05s - 16.37s | n/a | 211,095,734 bytes | 0 bytes | +| mui | 9.5.0 | 11.33s | 10.65s - 12.03s | n/a | 104,631,987 bytes | 0 bytes | +| **devup-ui (per-file CSS)** | 1.0.44 | **9.11s** | 8.61s - 9.27s | n/a | 69,803,573 bytes | 494 bytes | +| **devup-ui (single CSS)** | 1.0.44 | **9.23s** | 8.65s - 9.31s | n/a | 69,788,823 bytes | 395 bytes | Turbopack: -| Library | Version | Median Build Time | Range | Build Size | CSS Size | -| -------------------------------------- | ------- | ----------------- | ------------- | ---------------- | ----------- | -| tailwindcss | 4.3.3 | 5.68s | 5.51s - 5.73s | 38,440,013 bytes | 6,197 bytes | -| **devup-ui (direct APIs, single CSS)** | 1.0.44 | **5.79s** | 5.77s - 5.87s | 36,538,765 bytes | 327 bytes | -| **devup-ui (static `.css.ts`)** | 1.0.44 | **5.71s** | 5.67s - 5.99s | 36,580,207 bytes | 268 bytes | +| Library | Version | Median Build Time | Range | Client Size | Build Size (incl. caches) | CSS Size | +| -------------------------------------- | ------- | ----------------- | ------------- | ----------- | ------------------------- | ----------- | +| tailwindcss | 4.3.5 | 3.91s | 3.65s - 3.94s | n/a | 30,536,946 bytes | 6,196 bytes | +| **devup-ui (direct APIs, single CSS)** | 1.0.44 | **3.85s** | 3.60s - 4.02s | n/a | 28,905,488 bytes | 327 bytes | +| **devup-ui (static `.css.ts`)** | 1.0.44 | **3.91s** | 3.61s - 3.95s | n/a | 28,950,340 bytes | 268 bytes | -The Turbopack ranges do not overlap, so the direct-API median is 0.12s (2.1%) behind Tailwind on this fixture. The 3 cold samples were Tailwind `5.68s, 5.73s, 5.51s`, direct Devup UI `5.77s, 5.79s, 5.87s`, and static `.css.ts` `5.71s, 5.99s, 5.67s`. The fixtures have comparable app shapes, not pixel-identical styling: Tailwind styles the leading paragraph and button more heavily, while Devup UI exercises typed component/style props. Treat these as build-pipeline results rather than a per-rule microbenchmark. Every `.css.ts` module runs on the full Boa evaluator, which adds about 20 ms for the first module and under 1 ms for each further one. CI compares the Devup UI rows with a checked baseline (see `benchmark-gate.js` for the rule) and fails on a regression beyond the measured noise. +The Turbopack ranges overlap, so the direct-API median is 0.05s (1.3%) ahead of Tailwind on this fixture and the two are effectively at parity. The 3 cold samples were Tailwind `3.94s, 3.65s, 3.91s`, direct Devup UI `3.85s, 3.60s, 4.02s`, and static `.css.ts` `3.95s, 3.61s, 3.91s`. The fixtures have comparable app shapes, not pixel-identical styling: Tailwind styles the leading paragraph and button more heavily, while Devup UI exercises typed component/style props. Treat these as build-pipeline results rather than a per-rule microbenchmark. Every `.css.ts` module runs on the full Boa evaluator, which adds about 20 ms for the first module and under 1 ms for each further one. CI compares the Devup UI rows with a checked baseline (see `benchmark-gate.js` for the rule) and fails on a regression beyond the measured noise. ## How it works diff --git a/packages/vite-plugin/README.md b/packages/vite-plugin/README.md index 2682c5481..34ad7cf9d 100644 --- a/packages/vite-plugin/README.md +++ b/packages/vite-plugin/README.md @@ -75,33 +75,33 @@ npm install @devup-ui/webpack-plugin -[Latest CI benchmark](https://github.com/dev-five-git/devup-ui/actions/runs/37758611477) (commit `467a379a`, Devup UI 1.0.44) on `ubuntu-24.04` with Next.js 16.3.3. Every row is the median of 3 cold builds that ran in rotating order, shown with the range of the samples. All Next.js builds use the native TypeScript 7 CLI for type checking. The English and Korean tables are generated from the same checked result file, `benchmark-results.json`. +[Latest CI benchmark](https://github.com/dev-five-git/devup-ui/actions/runs/43770976836) (commit `c750d33c`, Devup UI 1.0.44, 2026-11-15) on `ubuntu-26.04` with Next.js 16.4.6. Every row is the median of 3 cold builds that ran in rotating order, shown with the range of the samples. All Next.js builds use the native TypeScript 7 CLI for type checking. The English and Korean tables are generated from the same checked result file, `benchmark-results.json`, which CI refreshes after every merge to main and records in `benchmark/history.json`, one entry per commit, so a slower build can be traced to the merge that caused it. -Build Size is every byte of the build output directory (`.next`, or `dist` for vinext), including caches and server output. The checked table retains its original historical CSS measurements, which recursively counted `.css` files throughout that output. New runs count only browser-shipped CSS: `.next/static/**/*.css` (Webpack `static/css` and Turbopack `static/chunks`) or vinext `dist/client/**/*.css`, excluding caches and server CSS. A missing browser-assets directory is an error; an existing directory with no CSS counts zero. Approved CSS measurement corrections are limited to explicitly named `devup-ui`, `devup-ui-single` and `vinext-devup-ui` rows. `bun benchmark-check.js --write-css-baseline devup-ui` retains the per-file mode; `bun benchmark-check.js --write-css-baseline devup-ui-single,vinext-devup-ui` selects only the other two rows in one comma-separated argument. Only selected existing rows' CSS bytes change; unlike `--write-baseline`, this preserves sample count, build bytes, ratios, tolerances, all unselected rows and calibration history. Missing or unsupported names and conflicting writer modes are rejected. +Client Size is the JavaScript and CSS shipped to the browser, uncompressed: `.next/static/**/*.{js,css}` or vinext `dist/client/**/*.{js,css}`. Build Size (incl. caches) is every byte of the build output directory (`.next`, or `dist` for vinext); most of it is the bundler cache and server output, and it moves by a few kilobytes between identical builds, so it is kept for continuity rather than as what users download. CSS Size counts only browser-shipped CSS: `.next/static/**/*.css` (Webpack `static/css` and Turbopack `static/chunks`) or vinext `dist/client/**/*.css`, excluding caches and server CSS. A missing browser-assets directory is an error; an existing directory with no CSS counts zero. Every size is measured on every sample and shown as the median; `benchmark-results.json` keeps the samples with their range, and rows measured before Client Size was recorded show n/a. Approved CSS measurement corrections are limited to explicitly named `devup-ui`, `devup-ui-single` and `vinext-devup-ui` rows. `bun benchmark-check.js --write-css-baseline devup-ui` retains the per-file mode; `bun benchmark-check.js --write-css-baseline devup-ui-single,vinext-devup-ui` selects only the other two rows in one comma-separated argument. Only selected existing rows' CSS bytes change; unlike `--write-baseline`, this preserves sample count, build bytes, ratios, tolerances, all unselected rows and calibration history. Missing or unsupported names and conflicting writer modes are rejected. Webpack: -| Library | Version | Median Build Time | Range | Build Size | CSS Size | -| --------------------------- | ------- | ----------------- | --------------- | ----------------- | ------------ | -| tailwindcss | 4.3.3 | 13.02s | 12.91s - 13.20s | 67,339,250 bytes | 5,852 bytes | -| styleX | 0.19.0 | 29.01s | 28.72s - 29.50s | 96,290,533 bytes | 425 bytes | -| vanilla-extract | 1.21.2 | 12.34s | 12.22s - 12.35s | 68,565,511 bytes | 294 bytes | -| kuma-ui | 1.6.4 | 13.55s | 13.49s - 13.57s | 75,627,429 bytes | 340 bytes | -| panda-css | 1.12.0 | 13.44s | 13.29s - 13.58s | 71,849,243 bytes | 15,615 bytes | -| chakra-ui | 3.37.0 | 20.29s | 19.95s - 21.06s | 207,425,028 bytes | 0 bytes | -| mui | 9.4.0 | 14.12s | 13.78s - 14.26s | 101,476,098 bytes | 0 bytes | -| **devup-ui (per-file CSS)** | 1.0.44 | **10.95s** | 10.87s - 11.09s | 67,427,695 bytes | 562 bytes | -| **devup-ui (single CSS)** | 1.0.44 | **11.04s** | 10.88s - 11.40s | 67,436,336 bytes | 790 bytes | +| Library | Version | Median Build Time | Range | Client Size | Build Size (incl. caches) | CSS Size | +| --------------------------- | ------- | ----------------- | --------------- | ----------- | ------------------------- | ------------ | +| tailwindcss | 4.3.5 | 10.23s | 10.16s - 11.07s | n/a | 69,807,397 bytes | 5,851 bytes | +| styleX | 0.19.2 | 24.33s | 24.04s - 25.58s | n/a | 99,500,267 bytes | 425 bytes | +| vanilla-extract | 1.21.3 | 10.14s | 9.56s - 10.29s | n/a | 70,957,513 bytes | 294 bytes | +| kuma-ui | 1.6.4 | 11.13s | 10.38s - 11.65s | n/a | 77,951,297 bytes | 340 bytes | +| panda-css | 2.5.0 | 11.04s | 10.14s - 11.22s | n/a | 75,860,686 bytes | 21,149 bytes | +| chakra-ui | 3.38.0 | 16.33s | 16.05s - 16.37s | n/a | 211,095,734 bytes | 0 bytes | +| mui | 9.5.0 | 11.33s | 10.65s - 12.03s | n/a | 104,631,987 bytes | 0 bytes | +| **devup-ui (per-file CSS)** | 1.0.44 | **9.11s** | 8.61s - 9.27s | n/a | 69,803,573 bytes | 494 bytes | +| **devup-ui (single CSS)** | 1.0.44 | **9.23s** | 8.65s - 9.31s | n/a | 69,788,823 bytes | 395 bytes | Turbopack: -| Library | Version | Median Build Time | Range | Build Size | CSS Size | -| -------------------------------------- | ------- | ----------------- | ------------- | ---------------- | ----------- | -| tailwindcss | 4.3.3 | 5.68s | 5.51s - 5.73s | 38,440,013 bytes | 6,197 bytes | -| **devup-ui (direct APIs, single CSS)** | 1.0.44 | **5.79s** | 5.77s - 5.87s | 36,538,765 bytes | 327 bytes | -| **devup-ui (static `.css.ts`)** | 1.0.44 | **5.71s** | 5.67s - 5.99s | 36,580,207 bytes | 268 bytes | +| Library | Version | Median Build Time | Range | Client Size | Build Size (incl. caches) | CSS Size | +| -------------------------------------- | ------- | ----------------- | ------------- | ----------- | ------------------------- | ----------- | +| tailwindcss | 4.3.5 | 3.91s | 3.65s - 3.94s | n/a | 30,536,946 bytes | 6,196 bytes | +| **devup-ui (direct APIs, single CSS)** | 1.0.44 | **3.85s** | 3.60s - 4.02s | n/a | 28,905,488 bytes | 327 bytes | +| **devup-ui (static `.css.ts`)** | 1.0.44 | **3.91s** | 3.61s - 3.95s | n/a | 28,950,340 bytes | 268 bytes | -The Turbopack ranges do not overlap, so the direct-API median is 0.12s (2.1%) behind Tailwind on this fixture. The 3 cold samples were Tailwind `5.68s, 5.73s, 5.51s`, direct Devup UI `5.77s, 5.79s, 5.87s`, and static `.css.ts` `5.71s, 5.99s, 5.67s`. The fixtures have comparable app shapes, not pixel-identical styling: Tailwind styles the leading paragraph and button more heavily, while Devup UI exercises typed component/style props. Treat these as build-pipeline results rather than a per-rule microbenchmark. Every `.css.ts` module runs on the full Boa evaluator, which adds about 20 ms for the first module and under 1 ms for each further one. CI compares the Devup UI rows with a checked baseline (see `benchmark-gate.js` for the rule) and fails on a regression beyond the measured noise. +The Turbopack ranges overlap, so the direct-API median is 0.05s (1.3%) ahead of Tailwind on this fixture and the two are effectively at parity. The 3 cold samples were Tailwind `3.94s, 3.65s, 3.91s`, direct Devup UI `3.85s, 3.60s, 4.02s`, and static `.css.ts` `3.95s, 3.61s, 3.91s`. The fixtures have comparable app shapes, not pixel-identical styling: Tailwind styles the leading paragraph and button more heavily, while Devup UI exercises typed component/style props. Treat these as build-pipeline results rather than a per-rule microbenchmark. Every `.css.ts` module runs on the full Boa evaluator, which adds about 20 ms for the first module and under 1 ms for each further one. CI compares the Devup UI rows with a checked baseline (see `benchmark-gate.js` for the rule) and fails on a regression beyond the measured noise. ## How it works diff --git a/packages/webpack-plugin/README.md b/packages/webpack-plugin/README.md index 468a1cf13..6ea0c3370 100644 --- a/packages/webpack-plugin/README.md +++ b/packages/webpack-plugin/README.md @@ -75,33 +75,33 @@ npm install @devup-ui/webpack-plugin -[Latest CI benchmark](https://github.com/dev-five-git/devup-ui/actions/runs/37758611477) (commit `467a379a`, Devup UI 1.0.44) on `ubuntu-24.04` with Next.js 16.3.3. Every row is the median of 3 cold builds that ran in rotating order, shown with the range of the samples. All Next.js builds use the native TypeScript 7 CLI for type checking. The English and Korean tables are generated from the same checked result file, `benchmark-results.json`. +[Latest CI benchmark](https://github.com/dev-five-git/devup-ui/actions/runs/43770976836) (commit `c750d33c`, Devup UI 1.0.44, 2026-11-15) on `ubuntu-26.04` with Next.js 16.4.6. Every row is the median of 3 cold builds that ran in rotating order, shown with the range of the samples. All Next.js builds use the native TypeScript 7 CLI for type checking. The English and Korean tables are generated from the same checked result file, `benchmark-results.json`, which CI refreshes after every merge to main and records in `benchmark/history.json`, one entry per commit, so a slower build can be traced to the merge that caused it. -Build Size is every byte of the build output directory (`.next`, or `dist` for vinext), including caches and server output. The checked table retains its original historical CSS measurements, which recursively counted `.css` files throughout that output. New runs count only browser-shipped CSS: `.next/static/**/*.css` (Webpack `static/css` and Turbopack `static/chunks`) or vinext `dist/client/**/*.css`, excluding caches and server CSS. A missing browser-assets directory is an error; an existing directory with no CSS counts zero. Approved CSS measurement corrections are limited to explicitly named `devup-ui`, `devup-ui-single` and `vinext-devup-ui` rows. `bun benchmark-check.js --write-css-baseline devup-ui` retains the per-file mode; `bun benchmark-check.js --write-css-baseline devup-ui-single,vinext-devup-ui` selects only the other two rows in one comma-separated argument. Only selected existing rows' CSS bytes change; unlike `--write-baseline`, this preserves sample count, build bytes, ratios, tolerances, all unselected rows and calibration history. Missing or unsupported names and conflicting writer modes are rejected. +Client Size is the JavaScript and CSS shipped to the browser, uncompressed: `.next/static/**/*.{js,css}` or vinext `dist/client/**/*.{js,css}`. Build Size (incl. caches) is every byte of the build output directory (`.next`, or `dist` for vinext); most of it is the bundler cache and server output, and it moves by a few kilobytes between identical builds, so it is kept for continuity rather than as what users download. CSS Size counts only browser-shipped CSS: `.next/static/**/*.css` (Webpack `static/css` and Turbopack `static/chunks`) or vinext `dist/client/**/*.css`, excluding caches and server CSS. A missing browser-assets directory is an error; an existing directory with no CSS counts zero. Every size is measured on every sample and shown as the median; `benchmark-results.json` keeps the samples with their range, and rows measured before Client Size was recorded show n/a. Approved CSS measurement corrections are limited to explicitly named `devup-ui`, `devup-ui-single` and `vinext-devup-ui` rows. `bun benchmark-check.js --write-css-baseline devup-ui` retains the per-file mode; `bun benchmark-check.js --write-css-baseline devup-ui-single,vinext-devup-ui` selects only the other two rows in one comma-separated argument. Only selected existing rows' CSS bytes change; unlike `--write-baseline`, this preserves sample count, build bytes, ratios, tolerances, all unselected rows and calibration history. Missing or unsupported names and conflicting writer modes are rejected. Webpack: -| Library | Version | Median Build Time | Range | Build Size | CSS Size | -| --------------------------- | ------- | ----------------- | --------------- | ----------------- | ------------ | -| tailwindcss | 4.3.3 | 13.02s | 12.91s - 13.20s | 67,339,250 bytes | 5,852 bytes | -| styleX | 0.19.0 | 29.01s | 28.72s - 29.50s | 96,290,533 bytes | 425 bytes | -| vanilla-extract | 1.21.2 | 12.34s | 12.22s - 12.35s | 68,565,511 bytes | 294 bytes | -| kuma-ui | 1.6.4 | 13.55s | 13.49s - 13.57s | 75,627,429 bytes | 340 bytes | -| panda-css | 1.12.0 | 13.44s | 13.29s - 13.58s | 71,849,243 bytes | 15,615 bytes | -| chakra-ui | 3.37.0 | 20.29s | 19.95s - 21.06s | 207,425,028 bytes | 0 bytes | -| mui | 9.4.0 | 14.12s | 13.78s - 14.26s | 101,476,098 bytes | 0 bytes | -| **devup-ui (per-file CSS)** | 1.0.44 | **10.95s** | 10.87s - 11.09s | 67,427,695 bytes | 562 bytes | -| **devup-ui (single CSS)** | 1.0.44 | **11.04s** | 10.88s - 11.40s | 67,436,336 bytes | 790 bytes | +| Library | Version | Median Build Time | Range | Client Size | Build Size (incl. caches) | CSS Size | +| --------------------------- | ------- | ----------------- | --------------- | ----------- | ------------------------- | ------------ | +| tailwindcss | 4.3.5 | 10.23s | 10.16s - 11.07s | n/a | 69,807,397 bytes | 5,851 bytes | +| styleX | 0.19.2 | 24.33s | 24.04s - 25.58s | n/a | 99,500,267 bytes | 425 bytes | +| vanilla-extract | 1.21.3 | 10.14s | 9.56s - 10.29s | n/a | 70,957,513 bytes | 294 bytes | +| kuma-ui | 1.6.4 | 11.13s | 10.38s - 11.65s | n/a | 77,951,297 bytes | 340 bytes | +| panda-css | 2.5.0 | 11.04s | 10.14s - 11.22s | n/a | 75,860,686 bytes | 21,149 bytes | +| chakra-ui | 3.38.0 | 16.33s | 16.05s - 16.37s | n/a | 211,095,734 bytes | 0 bytes | +| mui | 9.5.0 | 11.33s | 10.65s - 12.03s | n/a | 104,631,987 bytes | 0 bytes | +| **devup-ui (per-file CSS)** | 1.0.44 | **9.11s** | 8.61s - 9.27s | n/a | 69,803,573 bytes | 494 bytes | +| **devup-ui (single CSS)** | 1.0.44 | **9.23s** | 8.65s - 9.31s | n/a | 69,788,823 bytes | 395 bytes | Turbopack: -| Library | Version | Median Build Time | Range | Build Size | CSS Size | -| -------------------------------------- | ------- | ----------------- | ------------- | ---------------- | ----------- | -| tailwindcss | 4.3.3 | 5.68s | 5.51s - 5.73s | 38,440,013 bytes | 6,197 bytes | -| **devup-ui (direct APIs, single CSS)** | 1.0.44 | **5.79s** | 5.77s - 5.87s | 36,538,765 bytes | 327 bytes | -| **devup-ui (static `.css.ts`)** | 1.0.44 | **5.71s** | 5.67s - 5.99s | 36,580,207 bytes | 268 bytes | +| Library | Version | Median Build Time | Range | Client Size | Build Size (incl. caches) | CSS Size | +| -------------------------------------- | ------- | ----------------- | ------------- | ----------- | ------------------------- | ----------- | +| tailwindcss | 4.3.5 | 3.91s | 3.65s - 3.94s | n/a | 30,536,946 bytes | 6,196 bytes | +| **devup-ui (direct APIs, single CSS)** | 1.0.44 | **3.85s** | 3.60s - 4.02s | n/a | 28,905,488 bytes | 327 bytes | +| **devup-ui (static `.css.ts`)** | 1.0.44 | **3.91s** | 3.61s - 3.95s | n/a | 28,950,340 bytes | 268 bytes | -The Turbopack ranges do not overlap, so the direct-API median is 0.12s (2.1%) behind Tailwind on this fixture. The 3 cold samples were Tailwind `5.68s, 5.73s, 5.51s`, direct Devup UI `5.77s, 5.79s, 5.87s`, and static `.css.ts` `5.71s, 5.99s, 5.67s`. The fixtures have comparable app shapes, not pixel-identical styling: Tailwind styles the leading paragraph and button more heavily, while Devup UI exercises typed component/style props. Treat these as build-pipeline results rather than a per-rule microbenchmark. Every `.css.ts` module runs on the full Boa evaluator, which adds about 20 ms for the first module and under 1 ms for each further one. CI compares the Devup UI rows with a checked baseline (see `benchmark-gate.js` for the rule) and fails on a regression beyond the measured noise. +The Turbopack ranges overlap, so the direct-API median is 0.05s (1.3%) ahead of Tailwind on this fixture and the two are effectively at parity. The 3 cold samples were Tailwind `3.94s, 3.65s, 3.91s`, direct Devup UI `3.85s, 3.60s, 4.02s`, and static `.css.ts` `3.95s, 3.61s, 3.91s`. The fixtures have comparable app shapes, not pixel-identical styling: Tailwind styles the leading paragraph and button more heavily, while Devup UI exercises typed component/style props. Treat these as build-pipeline results rather than a per-rule microbenchmark. Every `.css.ts` module runs on the full Boa evaluator, which adds about 20 ms for the first module and under 1 ms for each further one. CI compares the Devup UI rows with a checked baseline (see `benchmark-gate.js` for the rule) and fails on a regression beyond the measured noise. ## How it works diff --git a/playwright.config.ts b/playwright.config.ts index 80f280522..89db941b0 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -45,6 +45,10 @@ export default defineConfig({ command: process.env.CI ? 'node e2e/serve-static.mjs 3099' : `bun run --filter landing ${process.env.LANDING_BUILD_MODE === 'next' ? 'build:next' : 'build'} && node e2e/serve-static.mjs 3099`, + // The landing renders the frozen e2e/fixtures/benchmark-results.json, so a + // benchmark refresh on main never changes a screenshot. CI sets the same + // variable on the landing builds it serves here. + env: { LANDING_BENCHMARK_DATA: 'fixture' }, url: 'http://localhost:3099', reuseExistingServer: !process.env.CI, timeout: 120_000, diff --git a/render-benchmark-readme.js b/render-benchmark-readme.js index abc7c36bd..a95af4c79 100644 --- a/render-benchmark-readme.js +++ b/render-benchmark-readme.js @@ -2,7 +2,8 @@ // READMEs that npm publishes from one checked result file, so every copy shows // the same run and the same numbers. // Every row is the median of the same number of cold samples, shown with its -// range. `benchmark-check.js --write-results` refreshes the file from a run. +// range. CI refreshes the file after every merge to main (benchmark-refresh.js); +// `benchmark-check.js --write-results` does the same by hand. // // bun render-benchmark-readme.js rewrite the sections // bun render-benchmark-readme.js --check fail when a README differs from them @@ -34,9 +35,9 @@ const TEXT = { ].map((name) => `packages/${name}/README.md`), ], intro: ({ run, samples }) => - `[Latest CI benchmark](${run.url}) (commit \`${run.commit}\`, Devup UI ${run.devupUi}) on \`${run.runner}\` with Next.js ${run.next}. Every row is the median of ${samples} cold builds that ran in rotating order, shown with the range of the samples. All Next.js builds use the native TypeScript 7 CLI for type checking. The English and Korean tables are generated from the same checked result file, \`benchmark-results.json\`.`, + `[Latest CI benchmark](${run.url}) (commit \`${run.commit}\`, Devup UI ${run.devupUi}, ${run.date.slice(0, 10)}) on \`${run.runner}\` with Next.js ${run.next}. Every row is the median of ${samples} cold builds that ran in rotating order, shown with the range of the samples. All Next.js builds use the native TypeScript 7 CLI for type checking. The English and Korean tables are generated from the same checked result file, \`benchmark-results.json\`, which CI refreshes after every merge to main and records in \`benchmark/history.json\`, one entry per commit, so a slower build can be traced to the merge that caused it.`, sizes: - "Build Size is every byte of the build output directory (`.next`, or `dist` for vinext), including caches and server output. The checked table retains its original historical CSS measurements, which recursively counted `.css` files throughout that output. New runs count only browser-shipped CSS: `.next/static/**/*.css` (Webpack `static/css` and Turbopack `static/chunks`) or vinext `dist/client/**/*.css`, excluding caches and server CSS. A missing browser-assets directory is an error; an existing directory with no CSS counts zero. Approved CSS measurement corrections are limited to explicitly named `devup-ui`, `devup-ui-single` and `vinext-devup-ui` rows. `bun benchmark-check.js --write-css-baseline devup-ui` retains the per-file mode; `bun benchmark-check.js --write-css-baseline devup-ui-single,vinext-devup-ui` selects only the other two rows in one comma-separated argument. Only selected existing rows' CSS bytes change; unlike `--write-baseline`, this preserves sample count, build bytes, ratios, tolerances, all unselected rows and calibration history. Missing or unsupported names and conflicting writer modes are rejected.", + "Client Size is the JavaScript and CSS shipped to the browser, uncompressed: `.next/static/**/*.{js,css}` or vinext `dist/client/**/*.{js,css}`. Build Size (incl. caches) is every byte of the build output directory (`.next`, or `dist` for vinext); most of it is the bundler cache and server output, and it moves by a few kilobytes between identical builds, so it is kept for continuity rather than as what users download. CSS Size counts only browser-shipped CSS: `.next/static/**/*.css` (Webpack `static/css` and Turbopack `static/chunks`) or vinext `dist/client/**/*.css`, excluding caches and server CSS. A missing browser-assets directory is an error; an existing directory with no CSS counts zero. Every size is measured on every sample and shown as the median; `benchmark-results.json` keeps the samples with their range, and rows measured before Client Size was recorded show n/a. Approved CSS measurement corrections are limited to explicitly named `devup-ui`, `devup-ui-single` and `vinext-devup-ui` rows. `bun benchmark-check.js --write-css-baseline devup-ui` retains the per-file mode; `bun benchmark-check.js --write-css-baseline devup-ui-single,vinext-devup-ui` selects only the other two rows in one comma-separated argument. Only selected existing rows' CSS bytes change; unlike `--write-baseline`, this preserves sample count, build bytes, ratios, tolerances, all unselected rows and calibration history. Missing or unsupported names and conflicting writer modes are rejected.", webpack: 'Webpack:', turbopack: 'Turbopack:', columns: { @@ -44,7 +45,8 @@ const TEXT = { version: 'Version', time: 'Median Build Time', range: 'Range', - size: 'Build Size', + client: 'Client Size', + size: 'Build Size (incl. caches)', css: 'CSS Size', }, note: ({ samples }, [tailwind, direct, stylesheet]) => { @@ -59,9 +61,9 @@ const TEXT = { ko: { files: ['README_ko.md'], intro: ({ run, samples }) => - `[최신 CI 벤치마크](${run.url}) (커밋 \`${run.commit}\`, Devup UI ${run.devupUi})는 \`${run.runner}\`에서 Next.js ${run.next}로 실행했습니다. 모든 행은 순서를 돌려 가며 측정한 cold build ${samples}회의 중앙값이며 샘플의 범위를 함께 보여줍니다. 모든 Next.js 빌드는 네이티브 TypeScript 7 CLI로 타입 검사를 수행합니다. 영어와 한국어 표는 같은 결과 파일 \`benchmark-results.json\`에서 생성합니다.`, + `[최신 CI 벤치마크](${run.url}) (커밋 \`${run.commit}\`, Devup UI ${run.devupUi}, ${run.date.slice(0, 10)})는 \`${run.runner}\`에서 Next.js ${run.next}로 실행했습니다. 모든 행은 순서를 돌려 가며 측정한 cold build ${samples}회의 중앙값이며 샘플의 범위를 함께 보여줍니다. 모든 Next.js 빌드는 네이티브 TypeScript 7 CLI로 타입 검사를 수행합니다. 영어와 한국어 표는 같은 결과 파일 \`benchmark-results.json\`에서 생성합니다. CI는 main에 병합될 때마다 이 파일을 갱신하고 커밋마다 하나씩 \`benchmark/history.json\`에 기록하므로, 빌드가 느려지면 원인이 된 병합을 찾을 수 있습니다.`, sizes: - '빌드 사이즈는 캐시와 서버 출력을 포함한 빌드 출력 디렉터리(`.next`, vinext는 `dist`)의 모든 바이트입니다. 체크인된 표는 출력 전체의 `.css` 파일을 재귀적으로 합산한 기존 CSS 측정값을 그대로 보존합니다. 새 실행은 브라우저에 제공되는 CSS만 측정합니다: `.next/static/**/*.css`(Webpack `static/css`, Turbopack `static/chunks`) 또는 vinext `dist/client/**/*.css`. 캐시와 서버 CSS는 제외합니다. 브라우저 에셋 디렉터리가 없으면 오류이며, 존재하지만 CSS가 없으면 0입니다. 승인된 CSS 측정 보정은 명시적으로 지정한 `devup-ui`, `devup-ui-single`, `vinext-devup-ui` 행으로 제한됩니다. `bun benchmark-check.js --write-css-baseline devup-ui`는 기존 per-file 모드를 유지하며, `bun benchmark-check.js --write-css-baseline devup-ui-single,vinext-devup-ui`는 쉼표로 구분한 인자 하나로 나머지 두 행만 선택합니다. 선택한 기존 행의 CSS 바이트만 바꾸고, `--write-baseline`과 달리 샘플 수, 빌드 바이트, 비율, 허용 오차, 선택하지 않은 모든 행과 보정 이력을 보존합니다. 이름 누락, 지원하지 않는 이름, 다른 쓰기 모드와의 혼용은 오류입니다.', + '클라이언트 사이즈는 브라우저에 제공되는 JavaScript와 CSS의 압축 전 크기입니다: `.next/static/**/*.{js,css}` 또는 vinext `dist/client/**/*.{js,css}`. 빌드 사이즈(캐시 포함)는 빌드 출력 디렉터리(`.next`, vinext는 `dist`)의 모든 바이트입니다. 대부분이 번들러 캐시와 서버 출력이고 같은 빌드끼리도 수 KB씩 달라지므로, 사용자가 받는 크기가 아니라 이전 결과와의 연속성을 위해 남겨 둡니다. CSS 사이즈는 브라우저에 제공되는 CSS만 측정합니다: `.next/static/**/*.css`(Webpack `static/css`, Turbopack `static/chunks`) 또는 vinext `dist/client/**/*.css`. 캐시와 서버 CSS는 제외합니다. 브라우저 에셋 디렉터리가 없으면 오류이며, 존재하지만 CSS가 없으면 0입니다. 모든 사이즈는 샘플마다 측정해 중앙값으로 보여 주며, `benchmark-results.json`에는 샘플과 범위가 함께 남습니다. 클라이언트 사이즈를 기록하기 전에 측정한 행은 n/a로 표시합니다. 승인된 CSS 측정 보정은 명시적으로 지정한 `devup-ui`, `devup-ui-single`, `vinext-devup-ui` 행으로 제한됩니다. `bun benchmark-check.js --write-css-baseline devup-ui`는 기존 per-file 모드를 유지하며, `bun benchmark-check.js --write-css-baseline devup-ui-single,vinext-devup-ui`는 쉼표로 구분한 인자 하나로 나머지 두 행만 선택합니다. 선택한 기존 행의 CSS 바이트만 바꾸고, `--write-baseline`과 달리 샘플 수, 빌드 바이트, 비율, 허용 오차, 선택하지 않은 모든 행과 보정 이력을 보존합니다. 이름 누락, 지원하지 않는 이름, 다른 쓰기 모드와의 혼용은 오류입니다.', webpack: 'Webpack:', turbopack: 'Turbopack:', columns: { @@ -69,7 +71,8 @@ const TEXT = { version: '버전', time: '빌드 시간 중앙값', range: '범위', - size: '빌드 사이즈', + client: '클라이언트 사이즈', + size: '빌드 사이즈(캐시 포함)', css: 'CSS 사이즈', }, note: ({ samples }, [tailwind, direct, stylesheet]) => { @@ -90,6 +93,7 @@ function table(text, rows) { columns.version, columns.time, columns.range, + columns.client, columns.size, columns.css, ] @@ -100,6 +104,7 @@ function table(text, rows) { row.version, bold(seconds(row.median)), range(row), + row.clientBytes === null ? 'n/a' : bytes(row.clientBytes), bytes(row.bytes), bytes(row.cssBytes), ]