Skip to content

Analyzer is running very slowly in IntelliJ #4012

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

Closed
gspencergoog opened this issue Oct 24, 2019 · 13 comments · Fixed by #4045
Closed

Analyzer is running very slowly in IntelliJ #4012

gspencergoog opened this issue Oct 24, 2019 · 13 comments · Fixed by #4045
Labels
Milestone

Comments

@gspencergoog
Copy link

Steps to Reproduce

As I edit the Flutter repo code, the responsiveness of the analyzer integration in IntelliJ seems to get worse and worse. It helps some to "clear caches and restart", but only for a little while. My memory limit for IntelliJ are boosted (-Xms512m -Xmx6144m -XX:ReservedCodeCacheSize=512m), so I don't think that's the issue, or if it is, it's using an awful lot of memory...

It's slow enough that as I edit code, I can watch the syntax highlighting update about once every two to 15 seconds, which is far to slow to be useful. The suggestions dialog takes 3-4 seconds to show up, and another second or two to populate, sometimes showing the little in-menu spinner for ten seconds before showing any information, and sometimes it just gives up after 20 seconds or so with "No Suggestions" when I know for sure that there are valid suggestions to make.

Is there any information I can collect for you that will help you fix this? It's really hampering my productivity.

I captured a CPU profiling snapshot while this was happening, if that helps.

Version info

✓] Flutter (Channel add_macos_platform, v1.10.15-pre.240, on Linux, locale en_US.UTF-8)
    • Flutter version 1.10.15-pre.240 at [redacted]
    • Framework revision 5a512e325c (2 hours ago), 2019-10-24 08:46:54 -0700
    • Engine revision f56623d65e
    • Dart version 2.6.0 (build 2.6.0-dev.8.1 d43cd7e909)

[✓] IntelliJ IDEA Community Edition (version 2019.2)
    • IntelliJ at /opt/my-intellij-ce-current
    • Flutter plugin version 40.2.4
    • Dart plugin version 192.7402
@alexander-doroshko
Copy link
Contributor

CPU snapshot would definitely help. Also, logs and auto-collected thread dumps (Help -> Compress Logs...)

@gspencergoog
Copy link
Author

OK, can I email them to you instead of posting them here? (I have your jetbrains email).

@alexander-doroshko
Copy link
Contributor

@gspencergoog Yes, you can send it directly to me. Even better, open an issue on YouTrack (Project: Web, Subsystem: Dart) and attach your snapshot and logs to the issue. To keep files private you should mark attachments as visible to jetbrains-team.
image

@gspencergoog
Copy link
Author

OK, the issue is https://youtrack.jetbrains.com/issue/WEB-42137

@jacob314 jacob314 added the bug label Oct 25, 2019
@jacob314 jacob314 added this to the On Deck milestone Oct 25, 2019
@alexander-doroshko
Copy link
Contributor

alexander-doroshko commented Oct 30, 2019

Thanks, I've analyzed the logs, the thread dumps and the CPU snapshot. The problem is with Flutter's TestLineMarkerContributor and/or declaresFlutter() and such.
image

@alexander-doroshko
Copy link
Contributor

alexander-doroshko commented Oct 30, 2019

Also, there are millions of log entries like this:

WARN - eInsight.daemon.LineMarkerInfo - Performance warning: LineMarker is supposed to be registered for leaf elements only, but got: CALL_EXPRESSION (class com.jetbrains.lang.dart.psi.impl.DartCallExpressionImpl) instead. First child: REFERENCE_EXPRESSION (class com.jetbrains.lang.dart.psi.impl.DartReferenceExpressionImpl)

Use PsiTreeUtil.getDeepestFirst(). See this commit as an example of a proper fix.

@devoncarew
Copy link
Member

@alexander-doroshko, thanks for the investigation!

@gspencergoog - I see the plugin version in your initial comment (40.2.4), but can you confirm that version by opening the Settings > Plugins page?

@devoncarew devoncarew modified the milestones: On Deck, M42 Oct 30, 2019
@gspencergoog
Copy link
Author

Yes, that's what I see on the Plugins page: 40.2.4

@devoncarew
Copy link
Member

Yes, from looking at the code we're re-parsing the pubspec file on each query (we have some caching for this, but this particular code path is effectively bypassing the cache).

@devoncarew
Copy link
Member

Moved the 2nd issue to #4036.

@marcglasberg
Copy link

I believe this issue should be reopened. The analyzer is still running very slowly in IntelliJ, for large projects.
I also opened this one: #4142

@marcglasberg
Copy link

@devoncarew
Copy link
Member

I believe this issue should be reopened. The analyzer is still running very slowly in IntelliJ, for large projects.

I believe the fix here should address the issue. It was committed after the last release and will go out as part of the next one, expected in early December.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants