Skip to content

Update Tally and accept its benchmark numbers - #7068

Merged
ondrejmirtes merged 6 commits into
2.3.xfrom
accept-tally-release-numbers
Nov 14, 2026
Merged

ondrejmirtes merged 6 commits into
2.3.xfrom
accept-tally-release-numbers

Conversation

@ondrejmirtes

@ondrejmirtes ondrejmirtes commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

Since #7067, Tally counts with its own build of CodSpeed's Valgrind and its tally_hooks extension, not with the codspeed CLI and instrument-hooks over FFI. The first commit accepted the numbers of that switch. After that, phpstan/tally#4 changed two things:

  • Warm simulated caches. Callgrind empties its simulated caches whenever instrumentation starts. Tally used to start it for every span, so the cycles of the smallest benchmarks (about 1–2K instructions) depended on which cache lines the code just before them touched. That is why 7 of them failed after Install Tally from its release branch, which brings CodSpeed's Valgrind #7067. Tally now starts instrumentation once, before the #[Warmup] calls, and only switches collection on and off for each span. Instruction counts are unchanged; the cycles of most benchmarks dropped.
  • New default tolerance: ±2 % instructions, ±5 % memory, and ±5 % cycles but at least 2,000 cycles, instead of ±10 % of everything. Complexity checks keep ±10 %. AnalysisBench keeps its own DurationTolerance.

This PR:

  • updates phpstan/tally to dev-release/1.x at c14039c,
  • turns on withNamedArguments(true) in tally.php, so tally accept writes #[ExpectedFor(dataSet: '…')] like the existing benchmarks, and restores the dataSet: names the first accept dropped,
  • accepts the numbers of the Benchmarks run of the Tally update: 106 faster, plus about 64 KiB more memory for bug-4300.php and bug-7214.php at the same PHPStan code. These memory peaks move in 64 KiB steps when anything earlier in the process changes; bug-4308.php moved the same way between older and newer 2.3.x commits.

Benchmarks will still fail on two cases, on purpose: bug-15061.php (+23 % instructions) and bug-4308.php (+70 % memory). They also fail on 2.3.x at 7ef85f5 with the old Tally, so they come from PHPStan commits after 20c433f, not from Tally, and this PR doesn't accept them. Against the artifacts of the last run, tally compare reports exactly those two and 451 unchanged.

Tally from release/1.x counts with its own build of CodSpeed's Valgrind and
the tally_hooks extension instead of the codspeed CLI and instrument-hooks
over FFI. Instructions stay the same, but the cycles of the smallest
benchmarks shift by a few compulsory cache misses: Callgrind flushes the
simulated cache when each span starts, and the code the hooks run before a
span now shares fewer cache lines with the benchmark. LoaderFactoryBench
reads its config with fewer instructions and less memory.

The memory of the two optional-keys blowup cases had grown already on 2.3.x
before the switch.

Amp-Thread-ID: https://ampcode.com/threads/T-01a1d73a-bab0-7223-9245-50c2c00f22c7
The cycles of the smallest benchmarks no longer depend on the cache lines the
code just before them touches, and the default tolerance is now ±2 %
instructions, ±5 % memory, and ±5 % cycles but at least 2,000 cycles.

Amp-Thread-ID: https://ampcode.com/threads/T-01a1d73a-bab0-7223-9245-50c2c00f22c7
The benchmarks name it dataSet:, and tally accept wrote it as the first
argument in the cases it rewrote.

Amp-Thread-ID: https://ampcode.com/threads/T-01a1d73a-bab0-7223-9245-50c2c00f22c7
The cycles of most benchmarks dropped now that the warm-up calls fill the
simulated caches. The memory of bug-4300.php and bug-7214.php moved by about
64 KiB with the new Tally at the same code.

bug-15061.php and bug-4308.php stay as they were: they are slower on 2.3.x
with the old Tally too, since commits after 20c433f.

Amp-Thread-ID: https://ampcode.com/threads/T-01a1d73a-bab0-7223-9245-50c2c00f22c7
@ondrejmirtes ondrejmirtes changed the title Accept the benchmark numbers of Tally's own Valgrind Update Tally and accept its benchmark numbers Nov 14, 2026
The after methods and the end of the process, such as freeing the container,
no longer run under Callgrind's cache simulation. The counts stay the same.

Amp-Thread-ID: https://ampcode.com/threads/T-01a1d73a-bab0-7223-9245-50c2c00f22c7
Its instructions and cycles depend on the memory layout of the process: at the
same code and Tally, a few more kilobytes of environment move them by up to 2 %
and 10 %, likely through whether serialize() can grow its string in place.
The update of Tally moved the layout.

Amp-Thread-ID: https://ampcode.com/threads/T-01a1d73a-bab0-7223-9245-50c2c00f22c7
@ondrejmirtes
ondrejmirtes merged commit 04856c1 into 2.3.x Nov 14, 2026
552 of 556 checks passed
@ondrejmirtes
ondrejmirtes deleted the accept-tally-release-numbers branch November 14, 2026 11:49
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.

1 participant