Repository navigation
Add wiki_prefixes bench: catamorphisms on prefix-closed Wikipedia titles - #187
Draft
adamv-symbolica wants to merge 1 commit into
Draft
adamv-symbolica wants to merge 1 commit into
adamv-symbolica wants to merge 1 commit into
Conversation
adamv-symbolica
marked this pull request as draft
November 13, 2026 15:56
Builds a map in which every non-empty prefix of every English Wikipedia article title holds a value (19.4M titles, 173M values) and times PathMap::val_count, into_cata_cached, into_cata_jumping_cached and hash on two copies: the map as built, in which no node is shared, and a separately built copy merkleized in place, in which every shared node hangs below a path that holds a value. Also times merkleize in place on a freshly built map. The title dump is not in the repository: the bench reads it from BENCH_DATA_DIR (default benches/), and without it prints how to fetch it and exits. WIKI_TITLES=<n> keeps an evenly spaced sample of about n titles. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
adamv-symbolica
force-pushed
the
adam/wiki-prefixes-bench
branch
from
November 13, 2026 16:21
112f39b to
64e7df1
Compare
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
benches/wiki_prefixes.rs, which times catamorphisms on a map holding every prefix of every English Wikipedia article title. In a head-to-head of the cata implementations in #31 and its merkle-cata predecessor, this was the real-world dataset where caching shared nodes under valued paths mattered most.What it measures
The bench builds a
PathMap<()>in which every non-empty prefix of every title in the English Wikipedia title dump holds a value. The dump used below has 19,359,924 titles, which give 173,370,009 values.It builds that map twice:
merkleizeturns each repeated subtrie, such as the endings_(disambiguation)or_(album), into one shared node. Because every path holds a value, every shared node sits below a path that holds a value.On each copy it times:
map.val_count();map.read_zipper().into_cata_cached(f)andmap.read_zipper().into_cata_jumping_cached(f), wherefreturns the sum of its children's results plus one if the path holds a value, so both return the number of values;map.read_zipper().hash().It also times
merkleize()in place on a freshly built map. Building the maps and dropping them are outside every timing.Data
The dump is not committed (~110 MB download, ~400 MB unpacked):
The bench reads it from
BENCH_DATA_DIR(defaultbenches/, where the file name is now gitignored). Without the file it prints the command above and exits 0, socargo benchand CI are unaffected.WIKI_TITLES=<n>keeps an evenly spaced sample of aboutntitles. A full run takes 7–10 minutes and peaks at 33–38 GB, so the bench is not inbench_ab.py's default set.Results
AMD EPYC 9B45, one core, median of 5 samples. All three branches were built from one checkout and target directory and run on the same machine.
val_countinto_cata_cachedinto_cata_jumping_cachedhashmerkleize