Repository navigation
HF-150: alternate base and head runs in the performance workflow - #1805
marcin-kordas-hoc wants to merge 17 commits into
Conversation
Base and head are checked out side by side and measured in two rounds with the order reversed in the second one, so drift of a shared runner is spread over both sides. The raw samples are kept as a workflow artifact. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
hyperformula-docs | 0a3aa26 | Commit Preview URL Branch Preview URL |
Dec 03 2026, 07:56 AM |
Keeping the raw samples as an artifact adds a new action dependency that the licence check flagged; persisting results across runs is left for a follow-up. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
e6539eb to
f3158cb
Compare
Performance comparison of head (0a3aa26) vs base (f59b0fa) with the tests at 63cf594
Threshold of an unmarked scenario = max(5%, 3 x the standard error of the difference of the two medians). † = the band of changes observed on identical code in earlier runs, instead of that rule. ‡ = a fixed threshold for a scenario that guards against a change of complexity class. This check is advisory: it reports regressions but does not fail the build. |
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| # Two rounds, each with half of the samples; the comparison merges the rounds of a side. The order is | ||
| # reversed in the second round (base, head, head, base) so that any effect of running first or second | ||
| # is shared by both sides. | ||
| - name: Run performance tests (alternating base and head) | ||
| env: | ||
| PERF_SAMPLE_SCALE: '0.5' | ||
| run: | | ||
| npm run benchmark:write-to-file --workspace=hyperformula head.json | ||
| run() { (cd "$1" && npm run benchmark:write-to-file --workspace=hyperformula "$GITHUB_WORKSPACE/$1-$2.json"); } | ||
| run base 1; run head 1 | ||
| run head 2; run base 2 |
There was a problem hiding this comment.
With base, head, head, base, both head rounds run back to back in the middle of the job, so a runner slowdown that spans rounds 2–3 lands only on the head. The round-spread check can't see it: it compares the rounds within one side, and both head rounds are slow by the same amount. On identical code, with the committed noise history:
// a 13% slowdown during rounds 2–3 (head-1, head-2)
compareSuites(mergeRounds([base1, base2]), mergeRounds([head1, head2]), undefined, history)
// 'Column ranges - add column' → regression, no notice
// the same slowdown during rounds 3–4 (head-2, base-2) → okThe eight-round order base head head base head base base head (scale 0.25) also cancels quadratic drift, but it only halves this effect (+7.05% vs ±6.4%, still regression). Could you name this blind spot under "What this suite cannot tell you" in the tests README?
There was a problem hiding this comment.
Added to "What this suite cannot tell you" in handsontable/hyperformula-tests@140876d2eb45cb2be7d25e4356b0ba428aa41180.
| # Exits non-zero when a results file is unreadable or nothing is comparable, so a broken comparison is a | ||
| # red check instead of a stale report. A regression is reported in the comment but does not fail this step. | ||
| # When the tests carry a noise history, each scenario is judged against the band of changes measured | ||
| # earlier on identical code. | ||
| - name: Compare the results | ||
| run: | | ||
| npm run benchmark:compare-benchmarks --workspace=hyperformula base.json head.json performance-report.md | ||
| HISTORY="$GITHUB_WORKSPACE/head/hyperformula/test/hyperformula-tests/performance/noise-history.json" | ||
| if [ -f "$HISTORY" ]; then export PERF_HISTORY_FILE="$HISTORY"; fi | ||
| cd head && npm run benchmark:compare-benchmarks --workspace=hyperformula "$GITHUB_WORKSPACE/base-1.json,$GITHUB_WORKSPACE/base-2.json" "$GITHUB_WORKSPACE/head-1.json,$GITHUB_WORKSPACE/head-2.json" "$GITHUB_WORKSPACE/performance-report.md" | ||
|
|
||
| # The runner is gone after the job; the raw samples in the log are what a later analysis can use. | ||
| - name: Print the raw samples | ||
| if: always() | ||
| run: | | ||
| for f in base-1 head-1 head-2 base-2; do | ||
| echo "::group::$f.json" | ||
| cat "$GITHUB_WORKSPACE/$f.json" 2>/dev/null || echo "(missing)" | ||
| echo | ||
| echo "::endgroup::" | ||
| done | ||
|
|
||
| - name: Publish a comment - header | ||
| uses: marocchino/sticky-pull-request-comment@6804b5ad49d19c10c9ae7cf5057352f7ff333f31 # https://github.com/marocchino/sticky-pull-request-comment/tree/v1.6.0 | ||
| with: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| message: | | ||
| ## Performance comparison of head (${{ github.event.pull_request.head.sha }}) vs base (${{ github.event.pull_request.base.sha }}) | ||
| ## Performance comparison of head (${{ github.event.pull_request.head.sha }}) vs base (${{ github.event.pull_request.base.sha }}) with the tests at ${{ steps.revisions.outputs.tests }} | ||
|
|
There was a problem hiding this comment.
When a benchmark round or the comparison fails, both sticky-comment steps are skipped, so the previous push's table and verdicts stay on the PR. That is the stale report the comment above this step says it avoids, and only the SHA in the header gives it away. Could you add a step like this after the publish steps, or reword the comment so it doesn't promise that?
- name: Publish a comment - failure
if: failure()
uses: marocchino/sticky-pull-request-comment@6804b5ad49d19c10c9ae7cf5057352f7ff333f31 # https://github.com/marocchino/sticky-pull-request-comment/tree/v1.6.0
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
message: |
## Performance comparison of head (${{ github.event.pull_request.head.sha }}) failed; see the job log.There was a problem hiding this comment.
Added a failure step in 4c4cee1: a failed run replaces the comment with one line that points to the job log.
| - **Bound the input.** Set a limit or a budget against huge ranges and very long strings. | ||
| - **Mind the bundle.** No unnecessary imports, polyfills or data tables. | ||
| - Run `npm run test:performance` for changes that may affect the evaluation or CRUD hot paths, and check the result is within noise. | ||
| - Run `npm run test:performance` for changes that may affect the evaluation or CRUD hot paths, and check the result is within noise. On a pull request, the Performance workflow posts a comment that gives each scenario a verdict against the noise measured on identical code. The verdicts are advisory; `hyperformula/test/hyperformula-tests/performance/README.md` explains how to read them. |
There was a problem hiding this comment.
Nit: not every scenario is judged against the noise measured on identical code. Sorted lookup uses a fixed ±50% threshold. Sheet A: change value, add/remove row/column has 9 observations in noise-history.json (10 are needed), so it falls back to the in-run rule. On a tests branch without the history file, no scenario uses it at all. Could you replace the last two sentences with something that holds for every scenario, for example:
On a pull request, the Performance workflow posts a comment with an advisory verdict for each scenario;
hyperformula/test/hyperformula-tests/performance/README.mdexplains where each threshold comes from and how to read the verdicts.
There was a problem hiding this comment.
Replaced with your sentence in 4c4cee1.
| # Base and head live side by side so their runs can alternate (base, head, base, head). Measuring one side | ||
| # in a single block and the other afterwards lets the drift of a shared runner show up as a "regression"; | ||
| # alternating spreads that drift over both sides. |
There was a problem hiding this comment.
Nit: this comment gives the order as base, head, base, head, but the run step below uses base, head, head, base. Could you drop (base, head, base, head) here, so the comment on the run step is the one place that states the order?
| - name: Run performance tests (alternating base and head) | ||
| env: | ||
| PERF_SAMPLE_SCALE: '0.5' | ||
| run: | | ||
| npm run benchmark:write-to-file --workspace=hyperformula head.json | ||
| run() { (cd "$1" && npm run benchmark:write-to-file --workspace=hyperformula "$GITHUB_WORKSPACE/$1-$2.json"); } | ||
| run base 1; run head 1 | ||
| run head 2; run base 2 | ||
|
|
||
| # Exits non-zero when a results file is unreadable or nothing is comparable, so a broken comparison is a | ||
| # red check instead of a stale report. A regression is reported in the comment but does not fail this step. | ||
| # When the tests carry a noise history, each scenario is judged against the band of changes measured | ||
| # earlier on identical code. | ||
| - name: Compare the results | ||
| run: | | ||
| npm run benchmark:compare-benchmarks --workspace=hyperformula base.json head.json performance-report.md | ||
| HISTORY="$GITHUB_WORKSPACE/head/hyperformula/test/hyperformula-tests/performance/noise-history.json" | ||
| if [ -f "$HISTORY" ]; then export PERF_HISTORY_FILE="$HISTORY"; fi | ||
| cd head && npm run benchmark:compare-benchmarks --workspace=hyperformula "$GITHUB_WORKSPACE/base-1.json,$GITHUB_WORKSPACE/base-2.json" "$GITHUB_WORKSPACE/head-1.json,$GITHUB_WORKSPACE/head-2.json" "$GITHUB_WORKSPACE/performance-report.md" |
There was a problem hiding this comment.
Which merges first, this PR or handsontable/hyperformula-tests#78? A pull_request run takes the workflow from the merge commit, so once this lands, every engine PR runs it against whatever tests branch fetch-tests.sh picks. The compare-benchmarks.ts on tests develop reads base-1.json,base-2.json as a single file name. It logs Cannot read results from …, exits 0 and writes no performance-report.md. The header step then replaces the comment with only the header, and the report step fails on the missing file. Those tests also ignore PERF_SAMPLE_SCALE, so all four rounds run the full 100 repetitions.
Could you state the merge order in the description, and say how paired tests branches older than #78 are handled? Either they merge tests develop in, or the compare step ends with test -s "$GITHUB_WORKSPACE/performance-report.md" so the failure is clear.
…n it fails A tests branch older than the two-round comparison exits 0 without writing performance-report.md; the compare step now fails on a missing report, and a failure comment replaces the previous push's table. The comment above the checkouts no longer gives the round order, and PERFORMANCE.md no longer says every scenario is judged against the noise measured on identical code. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # .github/workflows/performance.yml
Tobiadefami
left a comment
There was a problem hiding this comment.
Thanks, the earlier points are addressed.
blocking: The description has no AI assistance section, and neither has handsontable/hyperformula-tests#78. Could you add it to both, naming the tool and what it wrote?
One nit inline.
| # Replaces the previous push's table, so a failed run never leaves an older report standing for this head. | ||
| - name: Publish a comment - failure | ||
| if: failure() | ||
| uses: marocchino/sticky-pull-request-comment@5770ad5eb8f42dd2c4f34da00c94c5381e49af88 # v3.0.5 | ||
| with: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| message: | | ||
| ## Performance comparison of head (${{ github.event.pull_request.head.sha }}) failed; see the job log. |
There was a problem hiding this comment.
nit: failure() is false when the job hits timeout-minutes: 45 or is cancelled, so this step is skipped and the previous push's table stays on the PR, which the comment above says can't happen. if: failure() || cancelled() would cover it.
…celled failure() is false for a job stopped by timeout-minutes or cancelled, so the previous push's table stayed on the pull request. The step now runs on failure() || cancelled(), and its message says the comparison did not finish. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Note
Medium risk: CI-only change to the Performance workflow (checkout layout, alternating benchmark runs, comparison and PR comments); a defect here breaks the perf check on every PR but touches no product runtime code.
Full review: no issues found.
Want a deeper review? Comment /review improve on its own line: a full review of the latest commit with an extra fix-oriented pass (about 2x the cost).
There was a problem hiding this comment.
Note
Medium risk: CI tooling only (GitHub workflow plus one docs sentence) with no runtime effect, but a wrong merge order against hyperformula-tests#78 would make the Performance job fail on every PR until the paired tests branch is updated.
Full review: no issues found.
Want a deeper review? Comment /review improve on its own line: a full review of the latest commit with an extra fix-oriented pass (about 2x the cost).
Tobiadefami
left a comment
There was a problem hiding this comment.
The timeout case is fixed.
blocking: The description still has no ### AI assistance section, and neither does hyperformula-tests#78's. Could you add it to both?
| os: [ 'ubuntu-latest' ] | ||
| name: Test performance | ||
| runs-on: ${{ matrix.os }} | ||
| timeout-minutes: 45 |
There was a problem hiding this comment.
suggestion: Two runs for the same PR can overlap now: the job runs up to 45 minutes and nothing cancels the earlier run. If the earlier one finishes last, its table replaces the newer one, or its appended table lands under the newer header. A concurrency group would stop that:
concurrency:
group: performance-${{ github.event.pull_request.number }}
cancel-in-progress: trueThe cancelled run then posts its "did not finish" line, and the newer run replaces it.
### Context The PR adds an advisory workflow that compares base and head by the CPU instructions each performance scenario executes, instead of by time. - **Why:** on shared runners, wall-clock noise lets the timing comparison (#1805) show only regressions of about 5% or more per scenario, and it still reports false regressions. Instruction counts do not depend on the load of the runner. - **What changed:** - `.github/workflows/performance-instructions.yml`: installs valgrind, counts the instructions of every scenario for base and head (one after the other, from the same build directory), writes the comparison to the job summary and prints the raw counts into the log. Paths follow the monorepo layout. - The job never fails the pull request (`continue-on-error`) and posts no comment. `performance.yml` is unchanged. - When the paired tests branch has no `performance/run-instructions.ts`, the job skips the counts and the comparison with a notice instead of failing with module-not-found. - `hyperformula/dev-docs/PERFORMANCE.md`: one sentence about this workflow. - **Result:** every PR gets a per-scenario instruction-count comparison that can see changes well under 1%. - **Role:** the intended direction for the performance check, done in-house with valgrind on standard runners and without a vendor service. The wall-clock comparison stays as a temporary advisory layer, because instruction counts do not see GC pauses, memory or cache effects. ### How did you test your changes? - Paired tests branch: `feat/hf-150-instruction-count` in `hyperformula-tests`. - This PR changes no engine code, so every scenario should come out at about 0%. CI runs: | Run | Largest change over 13 scenarios | Job time | |---|---:|---:| | before the monorepo merge | 0.0075% | 7m39s | | after the monorepo merge (63b4b92) | 0.00022% | 10m37s | | with the runner check and the scenario table (7ded1cc, tests dae23a2) | 0.0056% | 11m58s | | with the action pins of `performance.yml` and the zero-count check (ff3019a, tests f9f0e41) | 0.00147% | 6m52s | - A throwaway control PR that added a fixed loop to `setCellContents` moved every scenario that calls it by +0.06% to +3.97%, and every other scenario by at most 0.013%. - Locally, in the monorepo layout: one scenario counted end to end under valgrind. - The runner check, run as a script against three tests refs: `develop` and `feat/hf-150-perf-gate` (no runner) print the notice and set no output, so the three guarded steps skip; `feat/hf-150-instruction-count` sets `present=true`. ### AI assistance Claude Code co-authored 5 of the 7 non-merge commits on this branch (the workflow) and 7 of the 8 on the paired `hyperformula-tests` branch (the instruction-count runner), as the `Co-Authored-By: Claude` trailers record. The other 2 and 1 commits carry no such trailer. ### Compatibility with Excel and Google Sheets Not applicable. ### Public API changes None. ### Out of scope and follow-ups - A blocking check. - Scale scenarios: stacked PR #1838 (100k rows in the wall-clock suite, 30k in the instruction count). ### Types of changes - [ ] Breaking change (existing functionality no longer works as before) – agreed with the maintainers - [ ] New feature or improvement (a non-breaking change that adds functionality) - [ ] Bug fix (a non-breaking change that fixes an issue) - [ ] Additional language file, or a change to an existing language file (translations) - [x] Change to the documentation CI tooling only, plus one sentence in `dev-docs/`. ### Related issues 1. HF-150 (internal task) ### Checklist - [ ] My pull request meets the [Definition of Done](https://github.com/handsontable/hyperformula/blob/develop/dev-docs/DEFINITION-OF-DONE.md). External contributors: see also [Contributing to HyperFormula](https://handsontable.com/docs/hyperformula/guide/contributing.html). - [ ] I have signed the [Contributor License Agreement](https://goo.gl/forms/yuutGuN0RjsikVpM2). - [x] I read my own diff end to end before requesting a review. - [x] I added a [CHANGELOG.md](https://github.com/handsontable/hyperformula/blob/develop/CHANGELOG.md) entry, written by [the changelog rules](https://github.com/handsontable/hyperformula/blob/develop/dev-docs/DOC-STANDARDS.md#the-changelog) – or none is needed (docs, tests or tooling only). - [x] I updated the documentation and JSDoc to match the change. - [ ] Breaking change only: I added a section to the migration guide. - [x] I updated the `dev-docs/` pages this change affects – or none needed it. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > CI-only addition with read permissions and no PR gating; engine code and public APIs are unchanged. > > **Overview** > Adds a **prototype GitHub Actions workflow** (`Performance (instruction count)`) that runs on pull requests alongside the existing wall-clock **Performance** job, without changing that workflow. > > The new job checks out **base** and **head**, shares the paired **hyperformula-tests** suite (including valgrind-based runners when present), runs `run-instructions.ts` sequentially for each side, compares results with `compare-instructions.ts`, and appends the report to the **job summary**. It uses **`continue-on-error`**, does not comment on the PR, and skips counting with a notice if `performance/run-instructions.ts` is missing on the tests branch. > > **`hyperformula/dev-docs/PERFORMANCE.md`** gains one sentence describing this advisory instruction-count check. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit ff3019a. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #1805 +/- ##
========================================
Coverage 97.78% 97.78%
========================================
Files 212 212
Lines 19316 19316
Branches 4563 4597 +34
========================================
Hits 18888 18888
- Misses 420 428 +8
+ Partials 8 0 -8 🚀 New features to boost your workflow:
|
Context
The PR changes the Performance workflow so that its wall-clock comparison of base and head resists runner drift and gives each scenario a verdict.
.github/workflows/performance.yml: base and head are checked out side by side and measured in four rounds (base, head, head, base), each with half of the samples. Both sides run the same copy of the paired tests.PERF_HISTORY_FILE) when it is present. It fails the job when the comparison itself is broken; a regression is only reported in the comment.hyperformula/test/hyperformula-tests,--workspace=hyperformula).hyperformula/dev-docs/PERFORMANCE.md: one sentence on how to read the comment.ok,regression,improvement,inconclusive); the tests README says where each threshold comes from.developcannot read the two-round arguments of this one. A paired tests branch older than Rename API methods #78 makes the job fail with "No performance report" until it merges testsdevelop.How did you test your changes?
feat/hf-150-perf-gateinhyperformula-tests.npm run test:jestwith the paired tests after the merge ofdevelop: 523 suites passed.ok. Two CI runs after the merge ofdevelop:In the second run the head was slower than the base in both of its rounds. False regressions still occur, so the check stays advisory. The earlier no-op series and the calibration are in the tests PR.
AI assistance
Claude Code co-authored 8 of the 10 non-merge commits on this branch and 10 of the 12 on the paired
hyperformula-testsbranch (handsontable/hyperformula-tests#78), as theCo-Authored-By: Claudetrailers record.Compatibility with Excel and Google Sheets
Not applicable.
Public API changes
None.
Out of scope and follow-ups
License Compliance(FOSSA) is red on this PR; the diff changes no dependency.Types of changes
CI tooling only, plus one sentence in
dev-docs/.Related issues
Checklist
dev-docs/pages this change affects – or none needed it.🤖 Generated with Claude Code
Note
Low Risk
Changes are limited to CI workflow and developer documentation; no engine, API, or runtime behavior is modified.
Overview
The Performance GitHub Actions workflow no longer measures base and head back-to-back on a single checkout. It checks out base and head into separate directories, shares the same paired hyperformula-tests copy on both sides, and runs benchmarks in four alternating rounds (
base,head,head,base) withPERF_SAMPLE_SCALE: 0.5so runner drift is spread across both revisions.Comparison now merges two JSON result files per side, optionally uses
PERF_HISTORY_FILEfrom the tests repo for scenario verdicts, and fails the job when comparison is broken or no report is written (while performance regressions stay advisory in the PR comment). The workflow adds a 45-minute timeout, logs revisions under test, always dumps raw sample JSON to the log, includes the tests SHA in the comment header, and posts a one-line failure comment instead of leaving a stale table.hyperformula/dev-docs/PERFORMANCE.mdadds a sentence pointing contributors to the PR comment and the tests performance README for thresholds and verdicts.Reviewed by Cursor Bugbot for commit eb690a6. Bugbot is set up for automated code reviews on this repo. Configure here.