Repository navigation
Conversation
…stay linear The arena build adds directories with add_child_raw (push_raw) and files with add_child (intern). push_raw dropped the lookup table, so the next intern rebuilt it over every name so far: once per directory, making a scan quadratic in the names it holds. push_raw now updates a table that exists and still builds none for a pool filled only raw.
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.
What
StringPool::push_rawthrew away the pool's lookup table, so the nextinternrebuilt it from every name in the pool. Building the arena on macOS (and anywhere the non-Linux walker builds aBuiltChildtree,walk.rs) adds each directory withadd_child_raw→push_rawand each file withadd_child→intern. So every directory triggered a full rebuild, and a scan's time grew with directories × names. It came in with 2203025, when the hot walker moved topush_raw.push_rawnow updates the table when one exists: a vacant slot takes the new id; an occupied one records it incollisions, asensure_indexdoes. A pool filled only raw still never builds a table, so the zero-hash path is unchanged.Numbers
Apple M5 Max, macOS, a cold in-memory scan (
Scanner::new(StorageMode::InMemory, …)thenscan_blocking) of a folder of git checkouts: 2,058,930 files, 362,568 directories.main(73bdbb3)Same file and directory counts before and after.
Tests
push_raw_keeps_a_built_index: fails onmain, passes here.push_raw_alone_builds_no_index: the raw-only path still never hashes.mixed_push_raw_and_intern_match_a_map_model: random interleavings (fixed seed) against a set:internreturns an id holding its value and never re-adds a value the pool holds.cargo xtask lintis green;cargo test -p disktree-scannerpasses.