Add an incremental resolution benchmark - #932
Open
soutaro wants to merge 4 commits into
Open
Conversation
soutaro
marked this pull request as ready for review
July 15, 2026 04:22
st0012
reviewed
Jul 15, 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.
Summary
This adds a benchmark for incremental resolution. It covers both the lightest case—a no-op resolve—and one of the heaviest incremental operations—an ancestor change.
Ancestor changes
The benchmark defines two empty modules:
It then repeatedly replaces a virtual source file between the following two versions:
Replacing the included module invalidates the target class's ancestor chain and triggers ancestor recalculation for its transitive descendants.
Target classes can be selected by descendant count, allowing light and heavy ancestor changes to be compared.
Results
On a monolith containing approximately 1.6 million declarations:
Merge time increases substantially with the number of descendants, although it remains small in absolute terms. Resolution time stays within approximately the same range regardless of descendant count.
This does not necessarily mean that ancestor recalculation takes constant time. After resolution, the graph still contained 37,040 pending work items:
Unresolved work is retained so that it can be retried after future edits. Consequently, even a no-op resolve revisits a large amount of pending work. This fixed cost dominates the additional ancestor recalculation and makes differences between targets difficult to observe in the overall resolution time.
How to run
First, find suitable target classes:
Run the benchmark for one or more classes reported by that command:
Inspect the unresolved and pending graph state:
The workspace can also be configured once through
DEFAULT_BENCH_WORKSPACE:export DEFAULT_BENCH_WORKSPACE=/path/to/workspace utils/bench-incremental-resolution --candidates utils/bench-incremental-resolution --target HeavyTarget utils/bench-incremental-resolution --resolution-stats