Repository navigation
Add write_zipper benchmarks and run the remaining benches in CI - #188
Merged
Adam-Vandervorst merged 3 commits intoNov 17, 2026
Merged
Conversation
A WriteZipper clones every node it descends into that has another owner, even when it never writes. No existing benchmark exercises this: none of them moves a WriteZipper through shared nodes. shared_descend_to_* runs the same 16 descents, 15 nodes deep, as a ReadZipper, as a WriteZipper over nodes it owns, and as a WriteZipper over the same trie with every node shared, sweeping the width of the nodes passed through from 1 to 256. Nothing writes to the trie. On a Xeon 6975P-C at width 256 the shared WriteZipper takes 381 us against 4.15 us owned and 3.2 us for the ReadZipper; at width 1 it is 0.73 us against 0.41 us and 0.28 us. The owned and read cases stay flat in width. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
shared_set_val_* runs the descents of shared_descend_to_*, each followed by set_val at the end of the path, as a WriteZipper over nodes it owns and over the same trie with every node shared. Here the clones are needed, so this is the cost that movement over shared nodes should not have. It also guards the other side of that trade: a WriteZipper that stops cloning on the way down has to walk the shared part of its path again when it writes, and these cases show what that costs. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The default set gains write_zipper, graft_masked_branches, restrict, prune, oeis, byte_mask, serde and pointcloud, which the bench job did not run. parallel, sla and multiplicities stay out; the comment on DEFAULT_BENCHES says why. bench_ab.py required every bench target to exist at base and at head, so a PR that adds a bench could not have it run. A target that only head has now runs for head alone and its numbers are reported without a comparison; one that only base has is skipped. A target that neither side has is still an error. Several of the added benches finish in under a second, which exposes a bias in how a pair is run: the side that goes first starts on an idle core and measures its first cases up to 50% slower (prune_path: 141 ns against 92 ns for the same binary run right after). Each pair now starts with a half-second spin on its core. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Collaborator
|
Yep, that's a bench. The code looks sane at a glance. |
imlvts
approved these changes
Nov 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a
write_zipperbench target, and makes the CI bench job run it together with the other benches it was skipping.The benchmark
A WriteZipper clones every node it descends into that has another owner, even when it never writes. No existing benchmark moves a WriteZipper through shared nodes, so nothing showed it.
shared_descend_to_{rz,wz_owned,wz_shared}: the same 16 descents, 15 nodes deep, as a ReadZipper, as a WriteZipper over nodes it owns, and as a WriteZipper over the same trie with every node shared. Nothing writes. The argument is the width of the nodes passed through.shared_set_val_{wz_owned,wz_shared}: the same descents, each followed byset_val. Here the clones are needed. These cases are there so that a change to how a WriteZipper moves over shared nodes also shows what it does to the write that follows.On an EPYC 9B45 (medians, 3 rounds):
rzwz_ownedwz_sharedset_valownedset_valsharedMoving over shared nodes costs as much as writing through them. This PR only adds the measurement.
CI
write_zipper,graft_masked_branches,restrict,prune,oeis,byte_mask,serdeandpointcloud. That is every divan bench that runs on one core.parallelstays out because its cases spawn up to 256 threads and each bench is pinned to one core;slaandmultiplicitiesare plainmains that print no divan table.bench_ab.pyrequired every bench target to exist at base and at head, so a PR that adds a bench (this one) failed the job. A target that only head has now runs for head alone and is reported without a comparison. One that only base has is skipped. One that neither has is still an error.prune_pathtook 141 ns, against 92 ns for the same binary run right after.Testing
I ran the job's script the way CI does (default set, 3 rounds, against master) on a 192-core EPYC 9B45:
binary_keysat 82 s per side still sets the wall time.write_zipperis reported as new in head, with its 25 cases listed.BENCHESthat neither side has fails with a message, and one that only base has is listed as skipped.No library code changes, so base and head bench binaries are byte-identical for every bench but the new one, which makes that run an A/A. Of 672 compared cases, 22 moved more than 5%, the largest by +102% (
superdense_zipper_prev_cursor/800) and −30% (pointcloudrun/query). That is the noise floor of three rounds on that machine; 18 of the 22 are in benches that were already in the set.🤖 Generated with Claude Code