-
Notifications
You must be signed in to change notification settings - Fork 11.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[move-ide] Avoid analyzing unmodified dependencies #20046
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
3 Skipped Deployments
|
/// Package path | ||
path: PathBuf, | ||
/// Manifest hash | ||
manifest_hash: Option<FileHash>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the manifest file the "right" thing to do here? It is possible a downstream dependency lives locally and got changed, and it appears this would not pick that change up. Is that correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, if the local dependency changes (whether direct or indirect), the IDE will not know about it. The idea here is that indeed if dependencies are changed "in the background" during a single editing session, things may indeed go out of sync, in which case re-starting the IDE will fix it (as everything will be re-fetched from disk).
In addition to what you observed, we also do not actually re-fetch (direct) remote dependencies if they change in the remote repo (GitHub). This is because the check for remote change had to happen at each compilation and was slowing down compilation/analysis enough that things like auto-completion was being too slow. Since we already do not track that, it seemed like only tracking explicit dependency changes (via manifest file changes) makes sense, as there is already a way when dependencies can change during a single editing session.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another way to look at it is that we mostly care about actions that user takes within the IDE (e.g., modify the manifest file), and largely do not care for actions taken outside of IDE (e.g., silent update of dependencies)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM other than manifest file question, which we should resolve before landing this. Stamping approved, but let us settle that.
Description
This PR implements an optimization to the symbolication algorithm that avoids analyzing dependencies if they have not changed. Previously we were avoiding re-compiling unchanged dependencies but we were still analyzing them which introduces unnecessary overhead.
The implementation involved separating analysis of the main program and the dependencies, and merging the results of the two together in the end (whether the dependencies are computed fresh or obtained from the cache). In particular, we now create two analysis visitors per analysis phase, one for the main program and one for the dependencies.
For a simple package with Sui framework as a dependency we observe a significant reduction in analysis time.
Before:
After:
Test plan
All existing test must pass. I also tested manually to verify that reporting references (now merged between the main program and the dependencies) works correctly.