Repository navigation
perf: keep walk workers off the shared heap lock - #1549
Merged
Merged
Conversation
Order pending directories by an inline rank so heap comparisons stay in the heap's memory, and let a worker register the directories it found and take back the earliest in one lock acquisition. skip-changelog: internal walk scheduling, same output
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 #1478
What
Walk workers spent nearly all their idle time acquiring the shared
openmutex, not waiting on the condvar. Instrumented on a 100k-file tree (18,579 dirs, 32 threads): about 200ms of about 230ms of total worker idle time was lock acquisition. Each heap comparison dereferencedArc<Slot>.key, memory another core had written, so every sift cache-missed while all the workers queued behind it.tree_walk.rsonly:Pendingcarries an inlineu128rank, an order-preserving encoding of the key's leading bytes. Most comparisons stay in the heap's own memory, and full keys break rank ties.listing.rsandscanner.rsare untouched.Timings
Paired and alternating against
fdfind, median per-pair ratio of(dirsql - startup) / fd, with the machine shared with other agents (load about 10). The query is./**/*.jsagainstfdfind --glob '*.js'../**/node_modules/pkg/*.jsagainst fd--full-pathon 100k: 0.89x on main, 0.67x with this PR.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)testing-conventions e2e attest 'uv run python -m pytest tests/e2e/glob_speed_*_test.py tests/e2e/query_contract_test.py tests/e2e/fanout_test.py tests/e2e/use_case_join_test.py tests/e2e/stat_speed_test.py tests/e2e/release_speed_test.py -q'(aftermaturin develop --releaseand a release CLI build);just e2e-attest-ts;cargo test --workspace --features cliChangelog:
skip-changelogtrailer (internal scheduling, same output).