batch: Reuse attribution source mappings#103
Merged
Merged
Conversation
Batch ownership attribution compares a file against the worktree and projects stored batch metadata onto the resulting attribution units. When a file belongs to an active batch, each attribution unit opens the same batch source and rebuilds the same source-to-worktree mapping. Large files with many units can make show or auto-advance spend most of their time repeating that comparison. This commit addresses that repeated work by opening each relevant batch source once per file attribution build, keeping its mapping alive with the rest of the file-scoped resources, and sharing the mapping between batch unit enumeration and ownership checks. The next commit will add a regression test for the mapping reuse behavior.
Batch attribution now reuses file-scoped batch source mappings while assigning ownership to attribution units. The project does not pin that behavior with a regression test. Later changes can reintroduce per-unit mapping rebuilds without changing ownership results, which makes the problem visible only on larger files. This commit addresses that by adding an ownership test that builds a file with multiple attribution units and verifies that attribution creates one baseline mapping and one batch-source mapping. The attribution performance fix is now covered by tests.
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.
Batch ownership attribution compares a file against the worktree
and projects stored batch metadata onto the resulting attribution
units.
When a file belongs to an active batch, each attribution unit
opens the same batch source and rebuilds the same
source-to-worktree mapping. Large files with many units can make
show or auto-advance spend most of their time repeating that
comparison.
These commits address that repeated work by opening each relevant
batch source once per file attribution build, keeping its mapping
alive with the rest of the file-scoped resources, and sharing the
mapping between batch unit enumeration and ownership checks. A
regression test pins the mapping reuse behavior.