Quench.
THE REJECTIONLEDGER

blog / · 4 min read · performance

Most optimizations do not survive measurement

Notes from a ledger of rejected changes. Superinstructions, inline allocation, tail-call conventions and a 33% win on one benchmark, all turned down, and the rule that turned them down.

Quench keeps a ledger of every optimization that was tried and what happened to it. By early November 2026 it had dozens of entries from the previous month. Most of them are rejections.

This post goes through some of the more instructive ones. The pattern is the same each time: a plausible idea, an estimate of what it should save, and a measurement that disagreed.

Expected against measured

What an idea was expected to address, and what it measured (% of run)expected sharemeasured effectSuperinstructions (raytrace)19.4%1.2%Polymorphic field chain (splay)6%1.3%
Expected: the share of dispatches or instructions the idea targeted. Measured: the actual effect on the whole row.

Superinstructions. Fusing the most common pair of instructions into one saves a dispatch. On RayTrace the top pair was 19.4% of all dispatches, which sounds like a large prize. Fused, it was worth about 1.2% of the row. Dispatch through a tail call is already only about 3 instructions, so there was little left to save.

A compare chain for polymorphic field reads. Estimated at 6% of Splay's instructions. Measured at about 1.3%, around 90 instructions per hit. The real cost on Splay was calls and allocation.

Re-specializing stale quickened instructions. Measured at 0.05% on Richards and 0.32% on DeltaBlue, with an upper bound of 1.3%.

Inline bump allocation. The allocation path was under 2% of the run. The collector's real cost was marking: 7.3% of Splay, 4.6% of EarleyBoyer.

The ones that went backwards

IdeaExpectedMeasured
Tail calling convention for compiled bodiescheaper calls12% slower per call with six live values (1.81 against 1.62 ns)
Merging duplicate constants in the compiler IR19 to 26% of IR is duplicatesrun cost up 0.09 to 0.67%, compile cost up too. The optimizer already merged them
A separate exit block per guardbetter diagnostics+2.4% run instructions on RayTrace
Single-pass register allocationfaster compilesgenerated code about 3 times slower
Evaluating leaf methods in placeskip the callRichards +6.6% instructions (about 470 per call against 173 for a normal activation)
Lower dictionary-mode thresholdfewer shapesshape count unchanged, a 300-method loop went from 1.1 s to 7.3 s
Young-only marking on Splayless GC workscore down 28% for 29% less memory

The duplicate-constant one is our favourite. A count showed that a fifth of the compiler's input was the same constants repeated, and Richards alone had 55,000 duplicates of 1,041 distinct values. Merging them made things slightly worse, because Cranelift's optimizer was already doing it for free.

The win we turned down

One change gave doubles a single global integer encoding. NavierStokes got 33.6% fewer cycles. It also made Crypto 2.6% slower and DeltaBlue 8.2% slower, so it was rejected.

That is the rule doing its job:

It is a strict rule. It is also the only one we found that stops an engine from slowly becoming a collection of trade-offs tuned to whichever benchmark someone looked at last.

When the process itself was the problem

On 5 November the project stopped and wrote down an uncomfortable observation: two weeks of JIT work had moved microbenchmarks by 5 to 12% while whole Richards stayed flat. About forty overlapping tasks across five lines of work were editing the same compiler code, and measuring and archiving was taking longer than coding.

The rules that came out of it:

  1. One critical path. A single ordered list of steps for the native tiers.
  2. Whole benchmarks only. A change is kept only if fixed-work instructions drop on a whole benchmark. A faster microbenchmark is not evidence.
  3. Full qualification only at a gate. The expensive 11-round comparison runs when a step is finished, not for every experiment.
  4. Two strikes. After two rejected variants of one mechanism, stop and rethink the mechanism.
  5. Short records. A task description fits in 25 lines and a result in 5.

What the ledger is for

A rejection is a result. It tells the next person, or the next agent, that the idea was tried, what it was expected to do and what it did. The fastest way to waste a week on an engine is to re-run an experiment someone already ran.

The other thing the ledger shows is where the time is not. After enough entries read "expected 6%, measured 1%", it becomes hard to avoid the conclusion that dispatch, quickening and allocation fast paths were never the problem. The cost was in calls, in field access and in everything the compiled code did not know. That is where the next two weeks went.

Try it

Quench builds from source with Cargo and runs TypeScript, JavaScript and WebAssembly.

Build and run

Work on it

Interpreter, JIT, AOT, GC, Node APIs. Every claim on this blog has a measurement you can rerun.

Where to start

Follow it

New posts land here as the engine moves. Star the repository or subscribe to the feed.

Star on GitHub Feed