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
analyzer takes a long time to process deletion of empty file on linux #55560
Comments
cc @DanTup |
@scheglov I had a quick look at this, and with some extra logging I can see that the deletion seems to trigger analyzing a lot of files: add new file
delete file
Looking in the code, I came across this line that adds all of sdk/pkg/analyzer/lib/src/dart/analysis/file_tracker.dart Lines 141 to 144 in 4b66657
I guess the intention is to ensure files that depend on the deleted file are re-analyzed. I don't know how much of that work is short-cut or whether it's possible to be more selective (in this case, 0 files depend on the deleted one). On my machine, the time spent re-analyzing for the Flutter repo is about 4s on the deletion. |
|
The analysis is correct, deleting a file is currently very expensive. |
@Hixie as a workaround for you, you might be able to change your editor to not write these lock files to the project - see https://www.emacswiki.org/emacs/LockFiles It does say "but it might not be wise to do this" without an explanation though 🥲 |
Yeah, I've changed my configuration already. :-) |
Does the analyzer have a graph of which files affect each other? |
STEPS TO REPRODUCE
flutter analyze --watch
in a big package, e.g. the flutter framework (https://github.com/flutter/flutter/tree/master/packages/flutter)touch foo.dart
rm foo.dart
EXPECTED RESULTS
Step 1 should take a while. Steps 2 and 3 should each trigger a very fast reanalysis.
ACTUAL RESULTS
Step 1 takes a while. Step 2 triggers a fast analysis. Step 3 triggers a multi-second analysis.
CONTEXT
This impacts users of IDEs that create temporary files with
.dart
extensions. For example, Emacs creates advisory lock files with names like.#animated_size_test.dart
when a file is edited and not saved. (Actually in the case of Emacs it's not even a file, it's a symlink to a non-existent file, but the effect on the analyzer is the same.) When a file is saved, reanalysis takes multiple seconds every time even though nothing has changed, because the editor deletes this temporary file with a.dart
extension.The text was updated successfully, but these errors were encountered: