Repository navigation
perf: wide directories make leaves on the judging threads and read entries without a copy - #1515
Merged
Merged
Conversation
… entries without a copy on Linux
This was referenced Oct 16, 2026
Closed
4 of 7 tasks
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.
Fixes #1461
Two changes for wide directories (hundreds of thousands of entries):
exploreused to build each file's leaf, which is its path-table row, serially afterjudge_allreturned. It now builds it inside the judging closure, so in a directory of at leastPARALLEL_ENTRIESentries row-building runs on every core.Takenis generic over what a file carries: a path, or the leaf made of it. PR perf: build path-table rows on the walk threads #1510 moved row-building intoexplore, but serially per directory, so this part was still open.rustix::fs::RawDir. It reads into a thread-local 1 MiB buffer, so a 2M-entry directory takes fewgetdentscalls and needs noCStringper name. Other Unix systems keepDir, and Windows keepsstd::fs::read_dir. Both are unchanged.Output is byte-identical: same md5 for
path, basename, dirover./*,./and./docson a 1.6M-item tree.Timings
These ran on the
glob_speed_one_leveltree (1.6M items per level). Other agents were running at the same time, load 5 to 18.Direct A/B, 11 interleaved runs each, median after/before:
./*././docsOn the 2M flat corpus,
./*went from 0.923s to 0.834s (0.904x). A deep tree (20k dirs × 10 files,./**/*.md) was neutral at 1.02x, within noise.The paired harness ran the
.//./docscases from #1471, untracked and not committed. Before and after ran on the same tree, two rounds each, and ratios are against the fastest native. Load made these noisy:./*./docs./This PR does not restore the #1471 cases. Getting
./and./docsreliably to 1.0x needs the wide-directory redesign: judging, sorting and moves hidden behind the read.E2E Verification
packages/python/e2e-attestations/<branch>.jsonreceipt written ifpackages/pythonchanged (just e2e-attest-python)packages/ts/e2e-attestations/<branch>.jsonreceipt written ifpackages/tschanged (just e2e-attest-ts)uv run maturin develop --release,cargo build --release -p dirsql --features cli,testing-conventions e2e attest 'uv run python -m pytest tests/e2e/glob_speed_one_level_test.py tests/e2e/glob_speed_recursive_test.py tests/e2e/glob_speed_depth_bound_test.py tests/e2e/glob_speed_gitignore_test.py tests/e2e/glob_speed_dotfiles_test.py tests/e2e/glob_speed_matchers_test.py tests/e2e/glob_speed_node_modules_test.py tests/e2e/glob_speed_symlink_test.py tests/e2e/stat_speed_test.py tests/e2e/query_contract_test.py -q',just e2e-attest-ts,cargo test --workspace --features cliChangelog / Migrations
packages/rust/changelog.d/2026-10-15-wide-directory-listing.mdpackages/rust/migrations.d/, every subsection but Summary_None._