Dart Analyzer performance + IDE = Duration(seconds: 'too many')

545 views
Skip to first unread message

Stryder

unread,
Oct 7, 2022, 4:07:41 PM10/7/22
to Dart Analyzer Discussion
It's getting worse and worse and I don't know where to go. I've cleared and cleaned and restarted everything so many times my computer has started to ask if _I'm_ ok. 

The basic gist is this: Using Android Studio (but also w/ VSCode) the fixes/intellisense/refactoring speed has become just absolutely intolerable. I will change a single line of code in a not significantly sized project and it will take seconds before any refactoring or auto-complete becomes available. And while 'seconds' doesn't seem like a lot, when it happens over and over and over, you start to build up some frustrations. And I've looked for solutions but submitting bugs just becomes so much finger pointing: "No, that's a Dart problem", "No that's a Flutter problem", "No, that's an issue with the IDE specific plugin" etc etc... and it's not like I'm sitting on some clunky machine. It's an intel beast with 64GBs of RAM and 36 cores running all the latest patches and updates.  My `flutter doctor` comes back clean, Dart and Flutter SDK's and plugins are both at the latest version. 

I've tried to search for solutions and there are _so_ many bugs/problems posted around this issue but it seems like none of them are being addressed and I feel like one of the biggest issues is that nobody up there at the big G is actually dogfooding their stack. And I mean Real Dogfood. I mean building and working in an actual project environment on a non-G connected laptop running the plugins/installs/IDE's as downloaded from the 'Real World' because this experience isn't something you're going to see by running flaky tests or trying to edit just a few lines here and there. It's not something you'll see/experience unless you're actually working in this environment. 

I've attached a slew of images and even my `doctor` output. Everything in the images is taken seconds apart at times and requires triggering a save, closing files, re-opening files or just, waiting, before 'fixes' becomes available.  In a couple cases, applying fixes before the analyzer finished the AST rebuild resulted in _more_ bugs as lines of code were changed erroneously or typos introduced _by the fix_ provided by the analyzer.

Where are we supposed to go for this? How do we get the info you need to fix this problem? I've deigned to try and dig in myself, but it's currently not even possible to build a developer environment for Android Studio much less the Plugins using the currently available instructions. I've tried and I've filed bugs and nada.  So even if the public wanted to help, we can't. We're stymied. We have to jump through all these hoops, some not achievable, to try and contribute back to what is called an Open Source Project and purportedly _invites_ contributions but in reality, offers no path.  Taking a look through the git log history of the Android Studio project shows **no** contributions from _any_ external users in the last 3 or 4 years. 

I'm sorry/notsorry for the rant, but it's gotten bad and it's started severely hampering my ability to get anything done.  As it stands, I spend every probably 5 to 10 minutes (maybe exaggerating, but it's definitely minutes) of every hour just fixing things that shouldn't need to be fixed, waiting for imports that were there or should take moments to look up, but take 15 seconds instead.  I want to keep using Flutter, I _like_ Dart, but I can't keep working like this.

Tell me how to help you trouble shoot this. How can I launch a dart-analyzer analyzer to gather stats and help you see where it's getting bogged down.  I use multiple versions of the IDEA tools suite most notably Rider, Python, Webstorm, and of course, IntelliJ, and _none_ of them show this sort of 'lag' except when I'm working with Dart.


import statement added to copyright preamble instead of next to other import statements.png
Broken AST after pasting top static const String 7 seconds till fixed.png
Broken AST 9 seconds resolution.png
Unable to locate class in same package or project pt 2.png
doctor.txt
Unable to locate class despite-package confirmed in pubspec.png
Unable to locate class in same package or project pt 1.png

Samuel Rawlins

unread,
Oct 7, 2022, 5:25:48 PM10/7/22
to analyzer...@dartlang.org, Brian Wilkerson
On Fri, Oct 7, 2022 at 1:07 PM Stryder <stry...@gmail.com> wrote:
It's getting worse and worse and I don't know where to go. I've cleared and cleaned and restarted everything so many times my computer has started to ask if _I'm_ ok. 

The basic gist is this: Using Android Studio (but also w/ VSCode) the fixes/intellisense/refactoring speed has become just absolutely intolerable. I will change a single line of code in a not significantly sized project and it will take seconds before any refactoring or auto-complete becomes available. And while 'seconds' doesn't seem like a lot, when it happens over and over and over, you start to build up some frustrations. And I've looked for solutions but submitting bugs just becomes so much finger pointing: "No, that's a Dart problem", "No that's a Flutter problem", "No, that's an issue with the IDE specific plugin" etc etc... and it's not like I'm sitting on some clunky machine. It's an intel beast with 64GBs of RAM and 36 cores running all the latest patches and updates.  My `flutter doctor` comes back clean, Dart and Flutter SDK's and plugins are both at the latest version. 

Sorry to hear about your experience. That's super frustrating. And sorry for what I'm about to say but I think the best way forward is, *ducks*, filing an issue. Or point us to the issues you are referring to. It may look like a mess, but the "is this a Dart problem? is this a Flutter problem?" investigations might be necessary to figuring out where the problem is...

I've tried to search for solutions and there are _so_ many bugs/problems posted around this issue but it seems like none of them are being addressed and I feel like one of the biggest issues is that nobody up there at the big G is actually dogfooding their stack.

I wouldn't fault anyone for just filing a new issue; it is super hard to identify which existing issue might be related to yours.
 
And I mean Real Dogfood. I mean building and working in an actual project environment on a non-G connected laptop running the plugins/installs/IDE's as downloaded from the 'Real World' because this experience isn't something you're going to see by running flaky tests or trying to edit just a few lines here and there. It's not something you'll see/experience unless you're actually working in this environment. 

It's interesting that you mention a "non-G connected laptop." What do you mean by that? I think we all use the same IDEs as our users, but maybe something about a Google-imaged laptop makes it faster? 

I've attached a slew of images and even my `doctor` output. Everything in the images is taken seconds apart at times and requires triggering a save, closing files, re-opening files or just, waiting, before 'fixes' becomes available.  In a couple cases, applying fixes before the analyzer finished the AST rebuild resulted in _more_ bugs as lines of code were changed erroneously or typos introduced _by the fix_ provided by the analyzer.

Sorry about that experience. :(  That first screenshot is a bummer. Why do you think this might be related to your performance issue?

Where are we supposed to go for this? How do we get the info you need to fix this problem? I've deigned to try and dig in myself, but it's currently not even possible to build a developer environment for Android Studio much less the Plugins using the currently available instructions. I've tried and I've filed bugs and nada.  So even if the public wanted to help, we can't. We're stymied. We have to jump through all these hoops, some not achievable, to try and contribute back to what is called an Open Source Project and purportedly _invites_ contributions but in reality, offers no path.  Taking a look through the git log history of the Android Studio project shows **no** contributions from _any_ external users in the last 3 or 4 years. 

Sorry about this. Can you give specifics? I'm not sure what "developer environment for Android Studio" you might be referring to, or the "Plugins."  

I'm sorry/notsorry for the rant, but it's gotten bad and it's started severely hampering my ability to get anything done.  As it stands, I spend every probably 5 to 10 minutes (maybe exaggerating, but it's definitely minutes) of every hour just fixing things that shouldn't need to be fixed, waiting for imports that were there or should take moments to look up, but take 15 seconds instead.  I want to keep using Flutter, I _like_ Dart, but I can't keep working like this.

Tell me how to help you trouble shoot this. How can I launch a dart-analyzer analyzer to gather stats and help you see where it's getting bogged down.  I use multiple versions of the IDEA tools suite most notably Rider, Python, Webstorm, and of course, IntelliJ, and _none_ of them show this sort of 'lag' except when I'm working with Dart.

I don't think we have any tooling to help identify lag... +Brian Wilkerson do we have instructions on how to collect a DAS client/server log from IDEA or Android Studio. Do we support Android Studio? 


--
You received this message because you are subscribed to the Google Groups "Dart Analyzer Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to analyzer-discu...@dartlang.org.
To view this discussion on the web visit https://groups.google.com/a/dartlang.org/d/msgid/analyzer-discuss/1f8db755-7e97-43d4-8890-b6e8333f241dn%40dartlang.org.

Brian Wilkerson

unread,
Oct 7, 2022, 6:04:37 PM10/7/22
to Dart Analyzer Discussion, Konstantin Shcheglov, Steve Messick
I'll start by echoing Sam's sentiment: I'm very sorry that you've had such a frustrating experience.

And I mean Real Dogfood. I mean building and working in an actual project environment on a non-G connected laptop running the plugins/installs/IDE's as downloaded from the 'Real World' ...

The analysis server is written in Dart and we do all of our development in both IntelliJ and VS Code and use the same plugins that everyone else uses, so to some extent we are dogfooding our own product. In fact, in many ways our experience is much closer to what our external users see than what our internal users see.

But you're absolutely right that we don't use our tools in the same way as our users. Our team isn't developing a Flutter app and we don't use Android Studio. And it's quite likely that our code base is smaller than the code bases of many of our users, so we might well not see the kind of scaling issues that our users run into.

I'm not sure how to realistically change that, but I do acknowledge that it's a problem.

... do we have instructions on how to collect a DAS client/server log from IDEA or Android Studio.

I don't know whether we have any documentation for it, but I found https://intellij-support.jetbrains.com/hc/en-us/community/posts/4407710497682-Dart-analysis-server-log.

The instrumentation log will tell us how much of a latency problem you're seeing, but it won't tell us what's causing the latency. We've talked several times about putting together documentation for how to gather better performance data, but haven't done so yet. Konstantin might be able to provide some instructions for what we think would be useful.

Do we support Android Studio?

Yes. I don't know whether the plugins are the same, but we do support both IntelliJ and Android Studio (AS), as well as VS Code. Steve is one of the main people working on AS support, so I've also looped him in in case he has more information.

Marcelo Glasberg

unread,
Oct 7, 2022, 6:23:41 PM10/7/22
to Dart Analyzer Discussion, sraw...@google.com, brianwilkerson
Hey, 

My team has exactly the same experience. We use very powerful machines running IntelliJ/Windows and we basically have to wait a few seconds after typing anything, as it "breaks" and we have to wait for the syntax highlight to come back. It's painful, it's been getting worse and worse each passing month, and it's only on Flutter/Dart. We keep waiting for all this to be fixed, but it never does. We completely stopped using code completion. Even stuff like rename refactors take so long that now we just to refactors manually, changing name by name (or with text-based replace). Find-usages and also fails a lot to show, as it just tells us something that's being used is not in use.

Our codebase is large, but I see this happening in much smaller projects too, it just takes less time to "recover". 

One thing I noticed is that, when it "breaks", most of the time it won't recover unless we type something in the editor. I usually type a space and the this seems to trigger a recover. But I still have to wait a few seconds before typing that space, otherwise it won't recover anyway.

I don't understand how the community is not going crazy after this. I guess most people just have small enough projects so that the pain for them is still small, and by now they got so used to the bad analyzer that they consider these bugs a fact of life.

You said it yourself in the documentation that the Dart-analyzer has problems:

Background - The APIs in this package were originally machine generated by a translator and were based on an earlier Java implementation. Several of the API's still look like their Java predecessors rather than clean Dart APIs. In addition, there is currently no clean distinction between public and internal APIs. We plan to address this issue but doing so will, unfortunately, require a large number of breaking changes. We will try to minimize the pain this causes for our clients, but some pain is inevitable.

Maybe the bad API has impacted the way the analyzer was developed. Maybe the analyzer needs to be redone from scratch, this time with performance in mind? Analyzer related problems and slowness are by far the largest pain point when developing in Dart/Flutter. 



Reply all
Reply to author
Forward
0 new messages