Repository navigation
bench: fit the anchor tree to vscode's node_modules, 4 KiB files - #38
Closed
markovejnovic wants to merge 2 commits into
Closed
markovejnovic wants to merge 2 commits into
markovejnovic wants to merge 2 commits into
Conversation
F0..F7 said nothing: reading a result meant looking the id up in registry.py. Each id now names the tree's shape and file count (balanced-58k, wide-51k, deep-58k, balanced-58k-4kib, large-1mib-files, tiny-125, balanced-333k, flat-58k). That's what pytest ids, chart file names and Bencher benchmarks show: demo/balanced-58k/warm/remmy@4. A test keeps each id's file count in step with its tree. Trees, tools, sampling and the decision rule are unchanged.
The anchor (585 dirs x 100 empty files) was mktree's defaults, with no source for calling it typical. Measured eight real node_modules trees (express to bitwarden/clients): every one has ~7-10 files per dir, not 100, and ~80% of files are <= 4 KiB, so each frees one block; none are empty. The anchor is now vscode's shape made uniform: fanout 4, depth 6, 7 files per dir (5,461 dirs, 38,227 files; vscode c17dab9 has 5,538 and 39,966). Every small-file tree uses 4 KiB files. The trees that vary one thing of the anchor follow it: wide-38k keeps its dirs and files at one level, flat-38k its file count in one dir, deep-36k a similar count. The huge tree is the anchor one level deeper (152k files, monorepo sized) instead of 333k, which at 4 KiB would write 1.3 GB per run. balanced-58k-4kib is gone: the anchor is that now.
markovejnovic
force-pushed
the
bench/fixture-names
branch
from
September 28, 2026 09:21
508e979 to
74255ef
Compare
Owner
Author
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.
Stacked on #36.
Summary
The anchor tree (585 dirs × 100 empty files) was just
mktree's defaults; nothing backed calling it a typicalnode_modules. I measured real ones (npm ci --ignore-scripts, macOS arm64, 2026-09-28):7de40fec17dab9852b61cbac4c66Every real tree has ~7–10 files per dir (the anchor had 100, so it underweighted directory work ~12×), ~2.7 subdirs per non-leaf dir, and median file size ~1 KiB. No real tree is empty files: APFS and ext4 give each small file one 4 KiB block to free.
The trees, all 4 KiB files except the 1 MiB one:
balanced-58kbalanced-38kwide-51kwide-38kdeep-58kdeep-36kbalanced-58k-4kiblarge-1mib-filestiny-125tiny-125balanced-333kbalanced-152kflat-58kflat-38kA uniform tree isn't a perfect fit: 75% of its dirs are leaves (vscode: 63%), and files sit deeper. Good enough for a synthetic benchmark.
Bencher: new names again, so new series. README: its charts and "58,500-file tree" come from the old trees and need a new full run.
Test plan
ruff check,ruff format --check, 36 bench unit tests (one fewer fixture)--bench=fullcollection lists the new idsmktreebuilds each new tree (except the unchanged 1 MiB one) with exactly the expected dir and file counts (≤ 4 s each)