Repository navigation
perf: match ZIP find paths by component prefix - #2519
Open
apex-mochen wants to merge 1 commit into
Open
apex-mochen wants to merge 1 commit into
apex-mochen wants to merge 1 commit into
Conversation
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.
ZipFileSystem.find()splits every archive member path into components for every directory lookup.glob()uses this path when discovering shards, so repeatedly opening partitions in a wide archive pays for the same Python allocations again.Compare already normalized member names using equality or a slash-delimited prefix. Normalize legacy backslash separators on demand and retain the original keys, detailed result order, depth rules and exact-file handling. This still scans the catalog and needs no secondary index.
End-to-end measurements
Each timed run opens a real local deflated ZIP, calls
fs.glob()over the requested partition or partitions, opens and reads every matched JSONL shard withcat_file(), then closes the ZIP. The repeated case reuses oneZipFileSystemwithin the run. Each shard contains one synthetic JSONL record of roughly 0.5 KiB. Archive construction and output hashing are outside the timed span. Windows, Intel Core i9-14900HX, Python 3.12.14, baselinebaeaac93e2688cd7bb67b35b75df6d335a42a62b, warmed OS cache, median of five measured runs after warm-up with alternating order.File paths, output order and bytes matched in every pair. The 16-partition read on the large archive improved about 52%. Initialization limited the improvement for one partition on the large archive. These figures are for local ZIPs with small shards.
Validation
findcalls, comparing values and insertion order against the original method with separator aliases, exact matches and depth limits.git diff --checkpassed.Reproduce the benchmark and differential checks
Run from the candidate checkout with fsspec importable.