ac-bench
Explanation

Explanation

What an execution is isolated from

Every condition is measured in a child process or a fresh browser. What that child is isolated from, what it shares with the machine, and how the run makes the shared part visible.

measure measures every condition in a child: a Node process forked for it, or a fresh browser. This page explains what that child is isolated from, what it shares, and how the run makes the shared part visible.

The unit is a fork unit

A fork unit is a condition with no nested condition of its own. It runs its cases (and those its enclosing conditions declare, under their hooks) in one child: see Nested conditions.

Discovery imports every bench file once per runtime to learn the condition tree; measurement then starts one child per fork unit, per execution. Nothing a case does — a warm cache, a leaked timer, a heap left full — reaches another fork unit.

A measure’s scheduling.grouping narrows that further:

grouping children used by why
"condition" one per fork unit, its cases interleaved in rounds jitter, constant-time the cases share every phase of the process’s life
"case" one per case, executions of different cases shuffled together duration, resource case A’s garbage would be case B’s heap, and its JIT state would shape B’s

Executions, replicates, the isolated arm

The measurement plan (--mode, or the config’s measurementPlan) repeats each fork unit:

  • replicates executions in shuffled order, more up to maxReplicates when a gate asks for them;
  • isolatedRuns executions where each case runs alone.

Each execution is an independent draw of the process lottery (memory layout, JIT decisions, frequency), which is what the gates pool: see How a gate decides. The modes table lists what each mode stands for.

What the machine shares, and how the run shows it

CPU frequency, temperature, other processes and the parent itself are shared with every child. The parent, idle while a child measures, watches them:

  • the load average, the CPU frequency against the run’s best, and the hottest thermal zone, each classified as stable, drifting (a monotone trend) or unstable (an oscillation that crosses a contention threshold);
  • foreignCpuRatio: the cores busy outside the run’s own process tree (the parent, its children, their browsers), read from /proc. Above half a core on average during an execution, the execution is flagged contended;
  • the child’s resident set, over its whole process tree, so a browser’s renderers count.

A drifting execution is reported. An unstable one can be retried (retryOnInstability), and cooldown waits for the machine to return to its baseline before the next fork unit. None of these make a contended machine quiet: they make it visible, so a number measured during someone else’s build says so.

What each child is isolated from

Node child browser, isolation "browser"
other fork units’ heap, caches and timers ✓ ✓
other fork units’ JIT state ✓ ✓
the parent’s event loop ✓ ✓
other processes on the machine — —
CPU frequency and temperature — —

The last two rows are what the monitoring above reports.

A process per iteration (duration’s execution: "per-iteration-process", and command cases) is a different measurement: it times a cold start, and is the only way to see one.