Compute descendants as the inverse of linearized ancestors#892
Draft
soutaro wants to merge 1 commit into
Draft
Conversation
- Add Resolver::compute_descendants, run at the end of resolve() - Invert each declaration's Complete ancestors into descendant edges - Remove the per-linearization descendant bookkeeping it replaces - Fixes descendant over-counts from stale edges left by abandoned tentative parents Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
vinistock
reviewed
Jun 30, 2026
Comment on lines
+155
to
+160
| // Clear any previously recorded descendants. | ||
| for declaration in self.graph.declarations_mut().values_mut() { | ||
| if let Some(namespace) = declaration.as_namespace_mut() { | ||
| namespace.clear_descendants(); | ||
| } | ||
| } |
Member
There was a problem hiding this comment.
This is heavy handed. We should only clear descendants when the invalidation logic identifies that it's necessary to do so, otherwise incremental resolution is going to be super slow.
Contributor
Author
There was a problem hiding this comment.
Sure. I'm trying to support incremental resolution here.
One note: the current implementation is not super slow I think. It takes 0.5s for full resolution of our monolith, while I agree it's noticeable delay for user interaction -- editing files.
I will try incremental resolution performance profiling first.
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.
Resolver::compute_descendants, run at the end ofresolve()