Repository navigation
perf(hash-differ): stream-parse hash files to skip edges and deps - #22
Merged
Merged
Conversation
CompareHashFiles loaded both files into the full PersistedHashData struct, allocating target_edges (523k entries, 13.6M strings) and dependency_hashes only to discard them. With the seedable format this meant parsing ~2.7 GB of JSON to use ~100 MB of it. The new loadHashesForDiff uses a streaming JSON decoder that stops reading as soon as git_commit_sha and target_hashes are both found. With the current field order (target_hashes before target_edges), this skips ~1 GB per file without even tokenizing it. Measured on two real 1.3 GB seedable hash files (446k targets each): Full struct (before): 9.5s Streaming, parallel: 366ms (26x faster) Streaming, reordered: 3.9s (still 2.4x faster) Works correctly regardless of field order. Added a struct comment warning that reordering PersistedHashData degrades differ performance. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
mattnworb
approved these changes
Sep 29, 2026
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.
CompareHashFiles loaded both files into the full PersistedHashData struct, parsing ~2.7 GB of JSON to use ~100 MB. The seedable format added target_edges (523k entries, 13.6M strings) and dependency_hashes that the differ doesn't need.
The new
loadHashesForDiffuses a streaming JSON decoder that stops reading as soon asgit_commit_shaandtarget_hashesare found. With the current field order, it skips ~1 GB per file.Works correctly regardless of field order. Added a struct comment on
PersistedHashDatawarning that reordering fields degrades differ performance.🤖 Generated with Claude Code