diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml new file mode 100644 index 0000000..0e6eebb --- /dev/null +++ b/.github/workflows/benchmark.yml @@ -0,0 +1,119 @@ +name: benchmark + +# Measures the base and head revisions back to back in one job, so both sides share the same +# runner. GitHub-hosted runners are shared VMs: read the base → head comparison, not the absolute +# numbers, and keep publishing README figures from a quiet local machine. + +on: + pull_request: + paths: + - package.json + - pnpm-lock.yaml + - pnpm-workspace.yaml + - tools/** + - scripts/** + - src/** + - tsconfig*.json + - .github/workflows/benchmark.yml + workflow_dispatch: + inputs: + base-ref: + description: Revision to compare against + default: main + runs: + description: Fresh-process runs per checker (timing and checker scaling) + default: "5" + memory-runs: + description: Fresh-process runs per checker (peak memory) + default: "3" + +permissions: + contents: read + +concurrency: + group: benchmark-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + compare: + runs-on: macos-15 + timeout-minutes: 120 + env: + RUNS: ${{ inputs.runs || '5' }} + MEMORY_RUNS: ${{ inputs.memory-runs || '3' }} + steps: + - uses: actions/checkout@v7 + with: + path: head + - uses: actions/checkout@v7 + with: + path: base + ref: ${{ github.event.pull_request.base.sha || inputs.base-ref }} + - uses: voidzero-dev/setup-vp@v1.21.2 + with: + version: 1.3.0 + node-version: 26 + cache: false + run-install: false + - name: Install base + working-directory: base + run: vp install + - name: Install head + working-directory: head + run: vp install + - name: Record versions + run: | + for side in base head; do + echo "$side: $(cd "$side" && node_modules/.bin/vize --version), $(cd "$side" && node_modules/.bin/tsrs --version)" + done + sysctl -n machdep.cpu.brand_string hw.ncpu hw.memsize vm.loadavg + + # Alternate base and head per benchmark, so slow drift on the runner hits both sides. + - name: Timing (base) + working-directory: base + run: vp run --no-cache benchmark --runs "$RUNS" + - name: Timing (head) + working-directory: head + run: vp run --no-cache benchmark --runs "$RUNS" + - name: vize check scaling (base) + working-directory: base + run: vp run --no-cache benchmark:vize-checkers --runs "$RUNS" + - name: vize check scaling (head) + working-directory: head + run: vp run --no-cache benchmark:vize-checkers --runs "$RUNS" + - name: Peak memory (base) + working-directory: base + run: vp run --no-cache benchmark:memory --runs "$MEMORY_RUNS" + - name: Peak memory (head) + working-directory: head + run: vp run --no-cache benchmark:memory --runs "$MEMORY_RUNS" + + # Only reports produced by this job: a failed step must not fall back to committed results. + - name: Collect new reports + if: ${{ !cancelled() }} + run: | + mkdir -p reports/base reports/head + for side in base head; do + (cd "$side" && git ls-files --others --exclude-standard benchmark/results) | + while read -r report; do cp "$side/$report" "reports/$side/"; done + done + - name: Summarize + if: ${{ !cancelled() }} + run: | + node head/scripts/compare-results.mjs --base reports/base --head reports/head \ + >> "$GITHUB_STEP_SUMMARY" + { + echo + echo "
Head reports" + echo + for report in reports/head/*.md; do + sed 's/^# /### /' "$report" + echo + done + echo "
" + } >> "$GITHUB_STEP_SUMMARY" + - uses: actions/upload-artifact@v7 + if: ${{ !cancelled() }} + with: + name: benchmark-results + path: reports diff --git a/README.md b/README.md index 0a37725..2fd45ec 100644 --- a/README.md +++ b/README.md @@ -72,6 +72,23 @@ vp run check:vize-cli It is intentionally excluded from the five-way Content Mapper table so that unlike pipelines are not presented as interchangeable. +### CI comparison + +The [`benchmark`](./.github/workflows/benchmark.yml) workflow runs on pull requests that touch +dependencies, scripts, the corpus, or tsconfig files, and on demand through `workflow_dispatch` +(`base-ref`, `runs`, and `memory-runs` inputs). It checks out the base and head revisions into one +`macos-15` job, alternates base and head for timing, `vize check` scaling, and peak memory, and +writes a base → head table to the job summary. The new reports are uploaded as the +`benchmark-results` artifact. + +GitHub-hosted runners are shared VMs with fewer cores than the recorded machine, so use the CI run +to see whether a version bump moves each lane, not as the published figures. Compare two result +directories locally with: + +```sh +vp run compare --base --head +``` + ## Recorded result Apple M5 Pro, 48 GiB RAM, Node.js 26.13.0, `vize@0.746.0`, `@vue/content-mapper@4.0.0-alpha.3`, diff --git a/package.json b/package.json index 60c42a3..a2786fb 100644 --- a/package.json +++ b/package.json @@ -20,13 +20,14 @@ "verify": "node scripts/verify-diagnostics.mjs", "benchmark": "node scripts/benchmark.mjs", "benchmark:vize-checkers": "node scripts/benchmark-vize-checkers.mjs", - "benchmark:memory": "node scripts/benchmark-memory.mjs" + "benchmark:memory": "node scripts/benchmark-memory.mjs", + "compare": "node scripts/compare-results.mjs" }, "devDependencies": { "@vue/content-mapper": "4.0.0-alpha.3", - "tsrs": "0.25.0-ts7.1.0-beta", + "tsrs": "7.1.0-beta.tsrs7", "typescript": "7.1.0-beta", - "vize": "0.746.0", + "vize": "0.826.0", "vite-plus": "1.3.0", "vue": "3.5.44" } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6a242ed..8fb2642 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,8 +12,8 @@ importers: specifier: 4.0.0-alpha.3 version: 4.0.0-alpha.3(typescript@7.1.0-beta) tsrs: - specifier: 0.25.0-ts7.1.0-beta - version: 0.25.0-ts7.1.0-beta + specifier: 7.1.0-beta.tsrs7 + version: 7.1.0-beta.tsrs7 typescript: specifier: 7.1.0-beta version: 7.1.0-beta @@ -21,8 +21,8 @@ importers: specifier: 1.3.0 version: 1.3.0(@vitest/ui@5.0.5)(@volar/typescript@2.4.30(typescript@7.1.0-beta))(@vue/language-core@3.3.14)(typescript@7.1.0-beta)(vue-tsc@3.3.14(typescript@7.1.0-beta)) vize: - specifier: 0.746.0 - version: 0.746.0(vue@3.5.44(typescript@7.1.0-beta)) + specifier: 0.826.0 + version: 0.826.0(vue@3.5.44(typescript@7.1.0-beta)) vue: specifier: 3.5.44 version: 3.5.44(typescript@7.1.0-beta) @@ -496,54 +496,54 @@ packages: peerDependencies: '@testing-library/dom': '>=7.21.4' - '@tsrs/darwin-arm64@0.25.0-ts7.1.0-beta': - resolution: {integrity: sha512-+pYoQ+AqpdUolO4kJBQlQmwxJOoc5INuusw/2AZnR4frfnyVGza+gEn0br8Z0LOk7nklQuILuMKH93BU3hpHvA==} + '@tsrs/darwin-arm64@7.1.0-beta.tsrs7': + resolution: {integrity: sha512-ReFWTefHpdpfeTr788cd8eQNZiwOingJhhFWRzdy2564NUz100F0hGUUFrJZr0dpGJ6ASML+YbGE6pU0KxyDrw==} engines: {node: '>=16.20.0'} cpu: [arm64] os: [darwin] - '@tsrs/darwin-x64@0.25.0-ts7.1.0-beta': - resolution: {integrity: sha512-MnD5Bv48TdIcTpNavsg7PV6RUuwAKhozJ29CZDlKq6oZwGjGulcQLI3Sok6MvvCG7U6v4l9RONKO8BhNXCytvQ==} + '@tsrs/darwin-x64@7.1.0-beta.tsrs7': + resolution: {integrity: sha512-GX/eu5Y9a2AeVrs6IiDKm1pe/LrR1qhCqWUqFcau9DxWvCHVzAnwMIEU/HvU4jVe2LvbtKrtl91CJI0ASWh/ZQ==} engines: {node: '>=16.20.0'} cpu: [x64] os: [darwin] - '@tsrs/linux-arm64-gnu@0.25.0-ts7.1.0-beta': - resolution: {integrity: sha512-Mc/YuFQa7APDuX39UMr8NMQHKkCOmEx8SfUXVnew7eljJHKnUkpLHpoQFQA0aKnzIqDAxnNudXhIWB0DjZEX2A==} + '@tsrs/linux-arm64-gnu@7.1.0-beta.tsrs7': + resolution: {integrity: sha512-Ot4+5Qh2QIKjzwYpM42E2r+b2I6y7e8Ltl6+c9RNO53QArhe+vDlJCwNQLocAvbrSvOrVQ5h7gPCi5W18CAZWQ==} engines: {node: '>=16.20.0'} cpu: [arm64] os: [linux] libc: [glibc] - '@tsrs/linux-arm64-musl@0.25.0-ts7.1.0-beta': - resolution: {integrity: sha512-ZTZxIv/W4qiqDBCXcDlr8ma76JCO0DQHbUukuhpSpKHz3E2m5FCwLcra/NTqAVniyLU6/RjIOCIcDRpVQvq6cQ==} + '@tsrs/linux-arm64-musl@7.1.0-beta.tsrs7': + resolution: {integrity: sha512-fmTaUsOKS05EdQZcKyyBRyQ/fzbhIA1DHm0iK2po1d7wO6FhaeexlZumCS/eosIUmG8URNjdvrGCcVh4rGSI3Q==} engines: {node: '>=16.20.0'} cpu: [arm64] os: [linux] libc: [musl] - '@tsrs/linux-x64-gnu@0.25.0-ts7.1.0-beta': - resolution: {integrity: sha512-dGRvubxWQXNP3aow+RLgFAbW3pR4oQ+UPfwrSgdggKCKKL9sAPr8nFGYM50JWAiqGQYSwRJl48AzIC7bHuQ2cQ==} + '@tsrs/linux-x64-gnu@7.1.0-beta.tsrs7': + resolution: {integrity: sha512-tPjGe8rVlGlTGKx8i95/BMnKXiFJswKZ/e+1YbQuhK8HcWiyYdr8J6YnrO1jjdOATuFmI21WZ/xGI7m3tGPCwQ==} engines: {node: '>=16.20.0'} cpu: [x64] os: [linux] libc: [glibc] - '@tsrs/linux-x64-musl@0.25.0-ts7.1.0-beta': - resolution: {integrity: sha512-zm89HYpXAv36XuXrEsfxAEmGTehY5K0L27+tFmJzxX2CqLwki0AX4FGA78Fy97x8Yk8kOR8FJO2xTvSW9vXBIg==} + '@tsrs/linux-x64-musl@7.1.0-beta.tsrs7': + resolution: {integrity: sha512-Kl+p6jSFCjarIzTwBFhjq6mEd18crtL5vGTShDuJsftRemtLXQrMfns4E34wvA5+foAfvRJhF5ZUCeHnSkYL/g==} engines: {node: '>=16.20.0'} cpu: [x64] os: [linux] libc: [musl] - '@tsrs/win32-arm64@0.25.0-ts7.1.0-beta': - resolution: {integrity: sha512-fVqAnHvFD2vxIHxVJEeQq9W63QZUW6WLy1+qFVuMUdM5ViURhjzcuLgOx8EIGqp6qOqFDpuAlNPQmjUpTXYg2g==} + '@tsrs/win32-arm64@7.1.0-beta.tsrs7': + resolution: {integrity: sha512-ywUQPt7eauuy+x6yCs2jm2L3er+p7+zO0tuLfmXjhtcnLdt3iZTGAhsceOQHd8lOnckRcdq2nhDLJ4SsM8bemg==} engines: {node: '>=16.20.0'} cpu: [arm64] os: [win32] - '@tsrs/win32-x64@0.25.0-ts7.1.0-beta': - resolution: {integrity: sha512-BfRCSI5E0LQ3kim43dBqX3Dq3dmRUI2aMWLGcgUxbTEkyvsESX01tM7u31flzRRajw3zVZwVB95kh5xvUeIOkA==} + '@tsrs/win32-x64@7.1.0-beta.tsrs7': + resolution: {integrity: sha512-HbZGdTvMD1M9YXNCfPgbMHqRa2FBxKuW3JM1DYEm+8FvfD8HUBH7QUBp0/2ZZngtywqFwdwmNxpc7IxPQ4bmUw==} engines: {node: '>=16.20.0'} cpu: [x64] os: [win32] @@ -760,60 +760,60 @@ packages: '@vitest/utils@5.0.5': resolution: {integrity: sha512-/rBu7gzLDQI/SC79Tn98b5DwOgaHU/Gt4I9OVeP3YofzNaYtbImRCOJQmT1S6vOJg9gEIlWC+r3QxKkjuSa1nQ==} - '@vizejs/native-darwin-arm64@0.746.0': - resolution: {integrity: sha512-yM+3GPYRyPNmSqlqwH7h27odU2egMokyxIyWafmJddpUkeLX8AGMPV7AkG3+vrG2jqq/MFvlkuE+xIfWWnl62g==} + '@vizejs/native-darwin-arm64@0.826.0': + resolution: {integrity: sha512-rbLetd42zYbzwQMlKTmF88pzdjxzjVvj81OLtSDUKeiuJxutuUbFQirFt9aaTJMMW3ri00XI+Z32VIrp4wI1EA==} engines: {node: '>=22'} cpu: [arm64] os: [darwin] - '@vizejs/native-darwin-x64@0.746.0': - resolution: {integrity: sha512-xy40dKijOZ44rXBHr+vDl0jIiHeXHGhkFptxPmlAyp0Txci/8NlvSY3ijgRJveQq6RfICd/Bh8xQyu4uYYQ9yQ==} + '@vizejs/native-darwin-x64@0.826.0': + resolution: {integrity: sha512-MzTMre2u/FCKVH6kTyxApkWk1frSLpRyqrqYoRrh2mP9mWMJPMwyc8Dlg2BlN2LCTyY6Q6sHZRI3NAWJO9Hfkw==} engines: {node: '>=22'} cpu: [x64] os: [darwin] - '@vizejs/native-linux-arm64-gnu@0.746.0': - resolution: {integrity: sha512-6elUApBoL8pWiJs6YuUW09EDiahVLca1af3buDG4qRSMaW6GSdZcBKpl+ndY3xIaHdEMEOyC1RGo/ys4OGc1Ug==} + '@vizejs/native-linux-arm64-gnu@0.826.0': + resolution: {integrity: sha512-Hvu8EijnC9dTBxl+H/QUd53eyx6ihq06RNG0z6A8xVrOEmBWpJg5qSJ0YfxCm6+KU+f5wBQ+JcUZMvlON+IW7A==} engines: {node: '>=22'} cpu: [arm64] os: [linux] libc: [glibc] - '@vizejs/native-linux-arm64-musl@0.746.0': - resolution: {integrity: sha512-xFSjfQ6ANri5l5v0GQSpOnJolFEw+LA2vHjmaSBovSResYjUY3K1HUtIL6ylpj0o4DxAnEcRrH7JheIFGe2YCw==} + '@vizejs/native-linux-arm64-musl@0.826.0': + resolution: {integrity: sha512-J4TmBIurpf8PVhCb42Me6jrGbYtgwjsL3sdUe1T8ZCV5pR4zs3P7iMHliS8CarFo1XZ6JLMLZADUGrxSbayaIA==} engines: {node: '>=22'} cpu: [arm64] os: [linux] libc: [musl] - '@vizejs/native-linux-x64-gnu@0.746.0': - resolution: {integrity: sha512-HbJm71zd4txZn6P3OX2EPWpILe6qj9NHUFXozAtN2xp6HHyK61ouEMSJmtCCmxcyviYrqFP4ZrLA1vAHt6JujQ==} + '@vizejs/native-linux-x64-gnu@0.826.0': + resolution: {integrity: sha512-s/fOPZtrlGuOC1lTJl71WiNuHB7wZwGytKuBi1wWWuJTl1UbgEW19i42iBiP0rsWMlYebZIqFfZMQhiXvM6ulQ==} engines: {node: '>=22'} cpu: [x64] os: [linux] libc: [glibc] - '@vizejs/native-linux-x64-musl@0.746.0': - resolution: {integrity: sha512-zWqNjvTnLNeIPMYTXuGL6C/tgBLCs0AFCPhIF0j4wz6oEIAsEArYh/JKeUJCpWEEGsVzROxMFzxDAPppYz+jIw==} + '@vizejs/native-linux-x64-musl@0.826.0': + resolution: {integrity: sha512-kWf4PJ+Xrke2OAnVBBDYPMyz2wzcWS7rCKs/FXO/YKAMfLX8qXrz7j2AvBNM5SrcdoTUpYhVqsXGSXaKm+xdNA==} engines: {node: '>=22'} cpu: [x64] os: [linux] libc: [musl] - '@vizejs/native-win32-arm64-msvc@0.746.0': - resolution: {integrity: sha512-qCD07sPgsugL/8Or5dgy90nsi3iZ1a8sgUi+A2b1W0KvcO0ZmjByQS+fXAHEYJ4sYVv+YsV7aKxZ0qj5KQ1UCQ==} + '@vizejs/native-win32-arm64-msvc@0.826.0': + resolution: {integrity: sha512-XHzM1J8o8b+UFs5Fge9zroBCJnw5N8DaNTn6r5bd9ZI/6he8eDWT2s3hqGhqIw7vvgs22KdLVqaYXy4B9BtGwg==} engines: {node: '>=22'} cpu: [arm64] os: [win32] - '@vizejs/native-win32-x64-msvc@0.746.0': - resolution: {integrity: sha512-doqXm3niHn0OMcm3JnP2GSW+IcKOhVmUxSuVkPa/VgOyH221T/NTwmaDci5+VtYKq6qmXWXa09y0ctKeAEjWYA==} + '@vizejs/native-win32-x64-msvc@0.826.0': + resolution: {integrity: sha512-LArGnnR5phyn0uUzFySt2nCG9cSAlFiN4U1w8kB89Qet4Tp80DCYwyCM542IVwoh66CSOgayEZBXVurj8UHM9w==} engines: {node: '>=22'} cpu: [x64] os: [win32] - '@vizejs/native@0.746.0': - resolution: {integrity: sha512-Nn5+GAHyCO6bZlG2ojiNXylbVjLDrGFyviLHNIO5Y4t4bUwkKxb2oXji4RRmH2/EnduHRVhGnILKg4aMY84Nbg==} + '@vizejs/native@0.826.0': + resolution: {integrity: sha512-t3wcwupHWF72MUtI1NFZ1/dNpUhj3I8eAMfu4t//ib5kwqEl+yP6Q7tu6vWegxBgQJSrjGANoKEIByOnx/N3hA==} engines: {node: '>=22'} '@voidzero-dev/vite-plus-core@1.3.0': @@ -1360,8 +1360,8 @@ packages: resolution: {integrity: sha512-sf4i37nQ2LBx4m3wB74y+ubopq6W/dIzXg0FDGjsYnZHVa1Da8FH853wlL2gtUhg+xJXjfk3kUZS3BRoQeoQBQ==} engines: {node: '>=6'} - tsrs@0.25.0-ts7.1.0-beta: - resolution: {integrity: sha512-J7eAkkriIwHExX2TzwTW6flJ/fmg3U+FDQwmTUkvaYmo02iva69YPmxFaCXGYIlsED3l1Aa62hSsEDJewBrIKA==} + tsrs@7.1.0-beta.tsrs7: + resolution: {integrity: sha512-4icnd4E6UlDHfvKo/TgbdrIHl9ey3n0HlcIGKpy0WGLiud2/erKJs+QCJjZrEwNkeEPWPeR3Pu8oBo9yP71qoQ==} engines: {node: '>=16.20.0'} hasBin: true @@ -1432,8 +1432,8 @@ packages: jsdom: optional: true - vize@0.746.0: - resolution: {integrity: sha512-Qt1/N7WhZ8vv3DM8A8biRikWqK3QixYV0hW+1M8G214+m00/YNdpOUYmzex7R0xX1Tjuxw4ik5eambAV5bqP+g==} + vize@0.826.0: + resolution: {integrity: sha512-W6Yh2YCBVbuPfguYXjT3/+BK+vF+NoFN97WqEKfQtLGGiTZYqSG2oJEl9GoswJzQZU7CsLOHFMb1NVPBF9OdNQ==} engines: {node: '>=22'} hasBin: true peerDependencies: @@ -1495,10 +1495,12 @@ packages: yuku-core@0.19.0: resolution: {integrity: sha512-kYK9e1XdfirNhkipzW0wmMcSWcVF/CWnuugodfVYRCUwvoBefweL9HzB96OiKEhsx78V5WbUxbJqlizMX869Qg==} engines: {node: '>=14.18.0'} + deprecated: 'Yuku is now one package with one core. Use "yuku" instead: https://yuku.fyi/javascript/. Existing installs keep working but get no more fixes.' yuku-parser@0.19.0: resolution: {integrity: sha512-XrBh9ZiQK5mJVRxZBAvD6LwRyAYrK3MFtH3+onyuxFL5hFD44EC3QOmIC1FjTj6H2MMwq46/NAI+NZxLZPZgxg==} engines: {node: '>=14.18.0'} + deprecated: 'Yuku is now one package with one core. Use "yuku" instead: https://yuku.fyi/javascript/. Existing installs keep working but get no more fixes.' snapshots: @@ -1746,28 +1748,28 @@ snapshots: dependencies: '@testing-library/dom': 10.4.2 - '@tsrs/darwin-arm64@0.25.0-ts7.1.0-beta': + '@tsrs/darwin-arm64@7.1.0-beta.tsrs7': optional: true - '@tsrs/darwin-x64@0.25.0-ts7.1.0-beta': + '@tsrs/darwin-x64@7.1.0-beta.tsrs7': optional: true - '@tsrs/linux-arm64-gnu@0.25.0-ts7.1.0-beta': + '@tsrs/linux-arm64-gnu@7.1.0-beta.tsrs7': optional: true - '@tsrs/linux-arm64-musl@0.25.0-ts7.1.0-beta': + '@tsrs/linux-arm64-musl@7.1.0-beta.tsrs7': optional: true - '@tsrs/linux-x64-gnu@0.25.0-ts7.1.0-beta': + '@tsrs/linux-x64-gnu@7.1.0-beta.tsrs7': optional: true - '@tsrs/linux-x64-musl@0.25.0-ts7.1.0-beta': + '@tsrs/linux-x64-musl@7.1.0-beta.tsrs7': optional: true - '@tsrs/win32-arm64@0.25.0-ts7.1.0-beta': + '@tsrs/win32-arm64@7.1.0-beta.tsrs7': optional: true - '@tsrs/win32-x64@0.25.0-ts7.1.0-beta': + '@tsrs/win32-x64@7.1.0-beta.tsrs7': optional: true '@types/aria-query@5.0.4': {} @@ -1930,40 +1932,40 @@ snapshots: convert-source-map: 2.0.0 tinyrainbow: 3.2.0 - '@vizejs/native-darwin-arm64@0.746.0': + '@vizejs/native-darwin-arm64@0.826.0': optional: true - '@vizejs/native-darwin-x64@0.746.0': + '@vizejs/native-darwin-x64@0.826.0': optional: true - '@vizejs/native-linux-arm64-gnu@0.746.0': + '@vizejs/native-linux-arm64-gnu@0.826.0': optional: true - '@vizejs/native-linux-arm64-musl@0.746.0': + '@vizejs/native-linux-arm64-musl@0.826.0': optional: true - '@vizejs/native-linux-x64-gnu@0.746.0': + '@vizejs/native-linux-x64-gnu@0.826.0': optional: true - '@vizejs/native-linux-x64-musl@0.746.0': + '@vizejs/native-linux-x64-musl@0.826.0': optional: true - '@vizejs/native-win32-arm64-msvc@0.746.0': + '@vizejs/native-win32-arm64-msvc@0.826.0': optional: true - '@vizejs/native-win32-x64-msvc@0.746.0': + '@vizejs/native-win32-x64-msvc@0.826.0': optional: true - '@vizejs/native@0.746.0': + '@vizejs/native@0.826.0': optionalDependencies: - '@vizejs/native-darwin-arm64': 0.746.0 - '@vizejs/native-darwin-x64': 0.746.0 - '@vizejs/native-linux-arm64-gnu': 0.746.0 - '@vizejs/native-linux-arm64-musl': 0.746.0 - '@vizejs/native-linux-x64-gnu': 0.746.0 - '@vizejs/native-linux-x64-musl': 0.746.0 - '@vizejs/native-win32-arm64-msvc': 0.746.0 - '@vizejs/native-win32-x64-msvc': 0.746.0 + '@vizejs/native-darwin-arm64': 0.826.0 + '@vizejs/native-darwin-x64': 0.826.0 + '@vizejs/native-linux-arm64-gnu': 0.826.0 + '@vizejs/native-linux-arm64-musl': 0.826.0 + '@vizejs/native-linux-x64-gnu': 0.826.0 + '@vizejs/native-linux-x64-musl': 0.826.0 + '@vizejs/native-win32-arm64-msvc': 0.826.0 + '@vizejs/native-win32-x64-msvc': 0.826.0 '@voidzero-dev/vite-plus-core@1.3.0(@volar/typescript@2.4.30(typescript@7.1.0-beta))(@vue/language-core@3.3.14)(typescript@7.1.0-beta)(vue-tsc@3.3.14(typescript@7.1.0-beta))': dependencies: @@ -2433,16 +2435,16 @@ snapshots: totalist@3.0.1: {} - tsrs@0.25.0-ts7.1.0-beta: + tsrs@7.1.0-beta.tsrs7: optionalDependencies: - '@tsrs/darwin-arm64': 0.25.0-ts7.1.0-beta - '@tsrs/darwin-x64': 0.25.0-ts7.1.0-beta - '@tsrs/linux-arm64-gnu': 0.25.0-ts7.1.0-beta - '@tsrs/linux-arm64-musl': 0.25.0-ts7.1.0-beta - '@tsrs/linux-x64-gnu': 0.25.0-ts7.1.0-beta - '@tsrs/linux-x64-musl': 0.25.0-ts7.1.0-beta - '@tsrs/win32-arm64': 0.25.0-ts7.1.0-beta - '@tsrs/win32-x64': 0.25.0-ts7.1.0-beta + '@tsrs/darwin-arm64': 7.1.0-beta.tsrs7 + '@tsrs/darwin-x64': 7.1.0-beta.tsrs7 + '@tsrs/linux-arm64-gnu': 7.1.0-beta.tsrs7 + '@tsrs/linux-arm64-musl': 7.1.0-beta.tsrs7 + '@tsrs/linux-x64-gnu': 7.1.0-beta.tsrs7 + '@tsrs/linux-x64-musl': 7.1.0-beta.tsrs7 + '@tsrs/win32-arm64': 7.1.0-beta.tsrs7 + '@tsrs/win32-x64': 7.1.0-beta.tsrs7 typescript@6.0.3: {} @@ -2552,9 +2554,9 @@ snapshots: transitivePeerDependencies: - msw - vize@0.746.0(vue@3.5.44(typescript@7.1.0-beta)): + vize@0.826.0(vue@3.5.44(typescript@7.1.0-beta)): dependencies: - '@vizejs/native': 0.746.0 + '@vizejs/native': 0.826.0 oxc-transform: 0.157.0 optionalDependencies: '@typescript/typescript-darwin-arm64': 7.0.2 diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 2dadec6..d35421d 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -1,22 +1,22 @@ packages: - tools/* minimumReleaseAgeExclude: - - '@tsrs/darwin-arm64@0.25.0-ts7.1.0-beta' - - '@tsrs/darwin-x64@0.25.0-ts7.1.0-beta' - - '@tsrs/linux-arm64-gnu@0.25.0-ts7.1.0-beta' - - '@tsrs/linux-arm64-musl@0.25.0-ts7.1.0-beta' - - '@tsrs/linux-x64-gnu@0.25.0-ts7.1.0-beta' - - '@tsrs/linux-x64-musl@0.25.0-ts7.1.0-beta' - - '@tsrs/win32-arm64@0.25.0-ts7.1.0-beta' - - '@tsrs/win32-x64@0.25.0-ts7.1.0-beta' - - '@vizejs/native-darwin-arm64@0.746.0' - - '@vizejs/native-darwin-x64@0.746.0' - - '@vizejs/native-linux-arm64-gnu@0.746.0' - - '@vizejs/native-linux-arm64-musl@0.746.0' - - '@vizejs/native-linux-x64-gnu@0.746.0' - - '@vizejs/native-linux-x64-musl@0.746.0' - - '@vizejs/native-win32-arm64-msvc@0.746.0' - - '@vizejs/native-win32-x64-msvc@0.746.0' - - '@vizejs/native@0.746.0' - - vize@0.746.0 - - tsrs@0.25.0-ts7.1.0-beta + - '@tsrs/darwin-arm64@7.1.0-beta.tsrs7' + - '@tsrs/darwin-x64@7.1.0-beta.tsrs7' + - '@tsrs/linux-arm64-gnu@7.1.0-beta.tsrs7' + - '@tsrs/linux-arm64-musl@7.1.0-beta.tsrs7' + - '@tsrs/linux-x64-gnu@7.1.0-beta.tsrs7' + - '@tsrs/linux-x64-musl@7.1.0-beta.tsrs7' + - '@tsrs/win32-arm64@7.1.0-beta.tsrs7' + - '@tsrs/win32-x64@7.1.0-beta.tsrs7' + - '@vizejs/native-darwin-arm64@0.826.0' + - '@vizejs/native-darwin-x64@0.826.0' + - '@vizejs/native-linux-arm64-gnu@0.826.0' + - '@vizejs/native-linux-arm64-musl@0.826.0' + - '@vizejs/native-linux-x64-gnu@0.826.0' + - '@vizejs/native-linux-x64-musl@0.826.0' + - '@vizejs/native-win32-arm64-msvc@0.826.0' + - '@vizejs/native-win32-x64-msvc@0.826.0' + - '@vizejs/native@0.826.0' + - vize@0.826.0 + - tsrs@7.1.0-beta.tsrs7 diff --git a/scripts/commands.mjs b/scripts/commands.mjs index 3e3e1a5..79ca077 100644 --- a/scripts/commands.mjs +++ b/scripts/commands.mjs @@ -34,7 +34,7 @@ export const commands = [ }, { id: "vue-tsrs", - label: "@vue/content-mapper 4.0.0-alpha.3 + tsrs 0.25.0", + label: "@vue/content-mapper 4.0.0-alpha.3 + tsrs 7.1.0-beta.tsrs7", executable: `node_modules/.bin/tsrs${binSuffix}`, args: [ "--runExternalCode", @@ -47,7 +47,7 @@ export const commands = [ }, { id: "vize-tsgo", - label: "Vize 0.746.0 Content Mapper + TypeScript 7.1 beta (tsc)", + label: "Vize 0.826.0 Content Mapper + TypeScript 7.1 beta (tsc)", executable: `node_modules/.bin/tsc${binSuffix}`, args: [ "--runExternalCode", @@ -60,7 +60,7 @@ export const commands = [ }, { id: "vize-tsrs", - label: "Vize 0.746.0 Content Mapper + tsrs 0.25.0", + label: "Vize 0.826.0 Content Mapper + tsrs 7.1.0-beta.tsrs7", executable: `node_modules/.bin/tsrs${binSuffix}`, args: [ "--runExternalCode", @@ -73,7 +73,7 @@ export const commands = [ }, { id: "vue-tsrs-fast", - label: "@vue/content-mapper 4.0.0-alpha.3 + tsrs 0.25.0 --fast", + label: "@vue/content-mapper 4.0.0-alpha.3 + tsrs 7.1.0-beta.tsrs7 --fast", executable: `node_modules/.bin/tsrs${binSuffix}`, args: [ "--fast", @@ -87,7 +87,7 @@ export const commands = [ }, { id: "vize-tsrs-fast", - label: "Vize 0.746.0 Content Mapper + tsrs 0.25.0 --fast", + label: "Vize 0.826.0 Content Mapper + tsrs 7.1.0-beta.tsrs7 --fast", executable: `node_modules/.bin/tsrs${binSuffix}`, args: [ "--fast", diff --git a/scripts/compare-results.mjs b/scripts/compare-results.mjs new file mode 100644 index 0000000..2ba656e --- /dev/null +++ b/scripts/compare-results.mjs @@ -0,0 +1,126 @@ +// Compare the newest benchmark reports of two result directories (for example, a pull request's +// base and head measured on the same CI runner) and print a Markdown summary. +// +// node scripts/compare-results.mjs --base --head +import { readFileSync, readdirSync } from "node:fs"; +import { join } from "node:path"; + +const readArgument = (name) => { + const index = process.argv.indexOf(name); + const value = index === -1 ? undefined : process.argv[index + 1]; + if (!value) throw new Error(`${name} is required`); + return value; +}; + +const baseDirectory = readArgument("--base"); +const headDirectory = readArgument("--head"); + +const kinds = [ + { key: "timing", pattern: /^\d{4}-\d{2}-\d{2}T[\d-]+Z\.json$/ }, + { key: "memory", pattern: /^memory-.+\.json$/ }, + { key: "checkers", pattern: /^vize-checkers-.+\.json$/ }, +]; + +/** Report file names embed an ISO timestamp, so the lexicographically last file is the newest. */ +function newest(directory, pattern) { + const file = readdirSync(directory) + .filter((name) => pattern.test(name)) + .sort() + .at(-1); + return file ? JSON.parse(readFileSync(join(directory, file), "utf8")) : undefined; +} + +const load = (directory) => + Object.fromEntries(kinds.map(({ key, pattern }) => [key, newest(directory, pattern)])); + +const base = load(baseDirectory); +const head = load(headDirectory); + +const seconds = (ms) => `${(ms / 1000).toFixed(3)} s`; +const gib = (bytes) => `${(bytes / 1024 ** 3).toFixed(2)} GiB`; + +/** Lower is better for every metric here; a ratio below 1 means head improved. */ +function change(baseValue, headValue) { + const ratio = headValue / baseValue; + const percent = (ratio - 1) * 100; + const sign = percent > 0 ? "+" : ""; + const mark = percent <= -3 ? " 🟢" : percent >= 3 ? " 🔴" : ""; + return `${sign}${percent.toFixed(1)}%${mark}`; +} + +/** Ranges that overlap cannot be told apart with this few samples. */ +const overlaps = (left, right) => left.min <= right.max && right.min <= left.max; + +function table({ title, columns, baseResults, headResults, keyOf, labelOf, metric, format }) { + if (!baseResults || !headResults) return `## ${title}\n\nNo report on one side; skipped.\n`; + const baseByKey = new Map(baseResults.map((result) => [keyOf(result), result])); + const rows = headResults + .map((headResult) => ({ headResult, baseResult: baseByKey.get(keyOf(headResult)) })) + .sort((left, right) => metric(left.headResult).median - metric(right.headResult).median) + .map(({ headResult, baseResult }) => { + const headMetric = metric(headResult); + if (!baseResult) { + return `| ${labelOf(headResult)} | — | ${format(headMetric.median)} | new | — |`; + } + const baseMetric = metric(baseResult); + return `| ${labelOf(headResult)} | ${format(baseMetric.median)} | ${format(headMetric.median)} | ${change(baseMetric.median, headMetric.median)} | ${overlaps(baseMetric, headMetric) ? "yes" : "no"} |`; + }); + return `## ${title} + +| ${columns} | Base | Head | Change | Ranges overlap | +| --- | ---: | ---: | ---: | :---: | +${rows.join("\n")} +`; +} + +const environment = head.timing?.environment ?? head.memory?.environment; +const describe = (report) => + report.results.map((result) => result.label).find((label) => /tsrs/.test(label)) ?? ""; + +const sections = [ + "# Benchmark comparison (base → head)", + "", + environment + ? `Head environment: ${environment.cpu}, ${environment.logicalCpus} logical CPUs, ${(environment.totalMemoryBytes / 1024 ** 3).toFixed(0)} GiB RAM, Node.js ${environment.node}, ${environment.platform}. Medians; 🟢/🔴 mark changes of 3% or more. Overlapping ranges mean the difference is within noise.` + : "", + "", + base.timing && head.timing + ? `- Base: ${describe(base.timing)}\n- Head: ${describe(head.timing)}\n` + : "", + table({ + title: "End-to-end time", + columns: "Checker (id)", + baseResults: base.timing?.results, + headResults: head.timing?.results, + keyOf: (result) => result.id, + labelOf: (result) => `\`${result.id}\``, + metric: (result) => ({ median: result.medianMs, min: result.minMs, max: result.maxMs }), + format: seconds, + }), + table({ + title: "Peak process-tree RSS", + columns: "Checker (id)", + baseResults: base.memory?.results, + headResults: head.memory?.results, + keyOf: (result) => result.id, + labelOf: (result) => `\`${result.id}\``, + metric: (result) => ({ + median: result.medianPeakTreeRssBytes, + min: result.minPeakTreeRssBytes, + max: result.maxPeakTreeRssBytes, + }), + format: gib, + }), + table({ + title: "`vize check` checker-worker scaling", + columns: "Checker workers", + baseResults: base.checkers?.results, + headResults: head.checkers?.results, + keyOf: (result) => result.checkers, + labelOf: (result) => String(result.checkers), + metric: (result) => ({ median: result.medianMs, min: result.minMs, max: result.maxMs }), + format: seconds, + }), +]; + +console.log(sections.join("\n"));