Skip to content

Add historical performance framework and results page - #2742

Merged
mathiasrw merged 8 commits into
developfrom
fix/2741
Oct 21, 2026
Merged

mathiasrw merged 8 commits into
developfrom
fix/2741

Conversation

@mathiasrw

@mathiasrw mathiasrw commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

Closes #2741

A framework in test/performance/ to measure every AlaSQL release on npm, one self-contained page that presents the results, and a command that tells whether the current build got slower than the latest release.

What is in it

  • historical/: bench.js results on Bun and on Node for every npm release that can run the benchmark (198 releases, 0.0.16 to 4.20.1), and for develop at 787cb25, the baseline for the v5 work. The README lists the few releases that are left out.
  • results.html: one HTML file with everything inlined: a speed index per release, the steps that mattered, a section per dimension with a chart per case, the full table, and a "Copy LLM recap" button. The i on every chart opens it larger with the SQL and what the case tests, why it matters and how to read it. All numbers come from one JSON block in the file.
  • bench.js: the ten core cases as before, plus 22 dimensions in dimensions/ (set operations, subqueries, the Slow query performance when dealing with a subquery #937 shape, LEFT JOIN, full sorts, GROUP BY cardinality, compile, correlated subqueries, mutations, predicate order, four-table joins, window functions, CTEs, nested JSON and SEARCH, UDFs, output modifiers, indexes, constraints and triggers, object shapes, coercion, memory, export). --scale=<x> multiplies every loop.
  • history.js: run downloads releases from npm, runs groups on them and merges the medians into historical/; page rebuilds the data block of results.html.
  • vs-npm.js: yarn test-perf runs every group on dist/ and on npm latest, interleaved, and prints one score (npm latest = 100, higher is slower), the change per runtime and per dimension, and the cases that changed most. --base, --target, --scale, --runs, --runtime, --fail-above. yarn test-perf-mini is --scale=0.5 --runs=2 --runtime=node --fail-above=105, a quick check of about 2 minutes. Neither runs in CI: shared runners are too noisy.

How a dimension is measured

Each group runs in its own process: a case alone can be up to 4 times faster than after other cases, so numbers only compare within a group. A dimension has seeded data, a sink, adaptive iterations and, for large allocations, the heap left after a run. Its answers are checked against develop's (expected.json): a build that answers differently is not timed and shows as "wrong answer". That already caught a wrong three-way UNION ALL in 4.0.0.

Noise, measured with develop against itself: the score moves by about 2, a dimension by up to about 10 percent, single cases more.

Findings filed from the data

#2736, #2737, #2738 (4.17.1 on Bun), #2739 (ORDER BY with LIMIT in 4.0.0), #2740 (WHERE filter in 0.3.2), #2744 (UNION is N × M and keeps duplicates of the second SELECT), #2745 (EXCEPT and INTERSECT with SELECT * on parameter arrays), #2746 (indexes are not used for WHERE), and #2731 (published builds report the previous version, fixed in #2732). #937 is still there: EXISTS over a derived table takes about 1,000 times longer than the JOIN.

The history of the 22 dimensions is being measured on all releases and goes into this branch when it is done.

This PR supersedes #2733.

@mathiasrw
mathiasrw merged commit 1c90103 into develop Oct 21, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Historical performance

1 participant