Is it possible to somehow configure Intellij (Andr...
# intellij
z
Is it possible to somehow configure Intellij (Android Studio) to work better? 🙂 I have 64 gb, and with all Kotlin files, which are more than 500 lines long is freezing a lot. Impossible to write code sometimes, because it's not unusual to stuck for more than 5s. Set to use 4 gb which is maximum in settings, but rarely come over 2gb. It's always dropping back to 1 gb (looking at bottom right corner). CPU cores are also very low all the time. Is there any special settings to squeze hardware a lot more? Because ram is more or less free, cpu is on few percent, but IDE is freezing 🙂
m
This seems to be a common problem across IntelliJ. JB is working on it from the IDE, plugin and compiler side of things, but to mixed effect. Generally speaking, using the latest available seems to yield the best results, but that sometimes leads to other issues. So, as much as we all love Kotlin, it does create some pain for larger projects...
I might suggest making the files a bit smaller to. Break things into their own files. That helps, as the compiler can then do incremental much better. If you have large files, then incremental doesn't work as well, as the compiler has to verify everything in that file, and possibly everything that depends on stuff from that file. It's a 'hack', as it shouldn't be required, but it may help you.
1
r
Yeah, its terrible. I'm in the same situation, with 32 cores and 64 Gb of RAM, and Kotlin in the IDE is barely usable. The 1.3.71 plugin seems a bit better, but marginally so. Go upvote https://youtrack.jetbrains.com/issue/KT-32158, and submit new issues with performance snapshots if you can. If you've got freeze thread dumps in your
.system/logs
directory submit those too.
m
Have you tried with 1.4-M1? And latest IntelliJ? Curious, although I totally understand if you don't want to risk it, as I don't think there's a way to rollback the plugin...
Actually, just realized I have a project that I can test this on. I was finding it getting slow as it is larger, and lots of interdependencies in the files. Noticed an improvement from 1.3.60 -> 1.3.70. So will try with 1.4-M1. 🤞
z
Great. Thanks! Looks like I'm not the only one 🙂
m
Unfortunately, no you aren't...
p
So how did it work out? Better on 1.4?
m
I'll try it this weekend and report in.
First, I haven't done any extensive testing. What I have done seems to be quick. It compiles a bit faster, and the little bit of auto-complete I did was snappy.
I'd suggest if you want to try it, use the Jetbrains toolbox to install the latest IntelliJ and only upgrade that version to the latest Kotlin plugin. Make a copy of your project, and upgrade it too, and see if it's any better.
👍 1
r
I just tried 1.4-M1. It still sucks. It might even be worse than 1.3.71. 😢
m
Did you also upgrade your project's Kotlin version to 1.4-M1?
r
No, but I wouldn't put much stock in that making a difference.
m
They are working to improve the compiler, but I'm not sure if JVM has been improved. They talked mostly about Native/JS improvements for M1.
r
Makes me want to go back to Scala. I can't believe its faster to write Scala in the IDE than Kotlin.
So frustrating that Jetbrains could let things get this bad. Its totally f-ing unusable.
m
I wonder how their internal devs feel about it. AFAIK, IntelliJ is a mixed codebase, and Kotlin was partly driven by their desire for a better language than Java, and Scala was oo slow on compilation... And the IntelliJ codebase must be HUGE.
a
Hey guys, as a member of IJ Kotlin plugin team, I can say that IJ developers work together with us on IDE performance, cause some root performance issues lie in IJ platform and can be solved only there. That’s why it’s important to keep updated not only Kotlin plugin, but IJ IDEA/AS as well. We’ve changed a code analysis algorithm in 2020.1 and it should improve syntax highlighting speed. We also consistently eliminate problems that cause freezes. IJ 2020.1 is on Beta 2 stage (is publicly available). In the first half of April, I hope, we will release IJ IDEA 2020.1. Please, try it and let us know about results.
👍 1
r
Thanks @Anton Yalyshev [JB] -- In for a penny, in for a pound. Lets go EAPs and milestones all the way 🙂 Installing 2020.1 now!
a
btw, speaking about code highlighting speed, IJ IDEA team does not suffer from it noticeably. Even the code base is huge, a file size mostly isn’t big. It helps IDE to analyse it quickly. The size of project, unfortunately, gives other challenges, like Find Usage / navigation speed, memory consumption, etc. We know about them and are working on solutions. At the same time, your feedback is always appreciated
👍 1
r
I have a file that is 193 lines long and about 30 of that is comments, and it takes 10 seconds to bring up the code completion on a 3rd party library class (and not just the first time -- almost every single time). At first glance it looks like 2020.1 is significantly faster to bring up the same code completion. However, I still see some of the same issues as with the earlier IDEA version. For example, cut a line and paste it in the same file brought up a modal for the "Resolve pasted references" modal which took about 10-15 seconds to execute. Why would the plugin even need to resolve pasted references for code moving within the same file, let alone why should it take 10 seconds to run?
a
yes, it seems that the plugin should not do this, but I need to checked details. I’ll take a look. Possibly, it could be solved by some simple optimisations
r
Dot-completion still seems to be very slow the first time on any particular class (several seconds), but now it does appear to cache and come up quickly subsequent times, which it wasn't doing before.
Resolve pasted references issue might be this one, which is marked as fixed in 1.4-M2: https://youtrack.jetbrains.com/issue/KT-37808
v
regarding resolving references in the same file... there are lots of corner cases like turned on optimize imports on fly, or moving class/function/property on level up/down - agree that in some cases it is not required - or at least it looks like it is not required
r
Yeah, in the case I am seeing, I'm moving a couple of lines of code within the same method -- none of those corner cases should apply (and my optimize imports on the fly is turned off)
a
We aim M2 approximately at the second half of April. It also means that we have some time to deliver new improvements. We would be very grateful if you file a new ticket with diagnostic information (from new versions of IJ and Kotlin plugin) to our issue-tracker. Cause we need both - your personal description of the case and technical information 🙂
r
Thanks, here is one issue I just created regarding slow file analysis: https://youtrack.jetbrains.com/issue/KT-37930 (2020.1 beta + 1.4-M1)
But I will say 2020.1 does feel significantly faster
I'm hoping perf fixes, if necessary can still be made to 2020.1 before release... have you had a chance to look at https://youtrack.jetbrains.com/issue/KT-37930? That and the resolve pasted references bug are true productivity killers.
@Anton Yalyshev [JB] -^
a
Speaking about pasted references bug - we just finished investigation and fixing of the problem: KT-37971, KT-37808. For now, I can’t give an estimation for KT-37930 but I can say that we continue to look for the best way to fix this problem.
👏 1
r
@Anton Yalyshev [JB] I also noticed today that using Kotlin in the Debugger expression view is dog-slow and causes 20 second+ freezes on almost every character typed
p
Wow great that you are tackling this issue :)
r
Regarding the slow debugger, I wonder if its at least partially related to a memory leak. After a restart of IJ, things seem faster. Next time it happens I'll take a memory snapshot.
No I think it was wishful thinking. The debugger is still "please-kill-me-now" slow.
@Anton Yalyshev [JB] I found something interesting... my project was using "Intellij IDEA" in the "Build and run using" setting, with the deprecated "resolveModulePerSourceSet" value set to false (in 2019.3 this was necessary due to another bug). In 2020.1 I've updated these settings to the recommended/default settings ("Gradle' in "Build and run using" and the "resolveModulePerSourceSet" setting removed) and now my performance across the board (highlighting, completion, debugging) is a lot better. Does this make any sense at all?
a
Yes, it’s really interesting. Changed build setting and IDE performance don’t look connected, but I’d better go and investigate this case with dev. team. May I ask you to attach new log to KT-37930? Perhaps it will help. Thanks a lot for this note!
z
A little update on that. Have tested with Intellij Community 2020.1.2 and it's completely different experience. Writing kotlin code is 100x faster (in larger classes - 200 lines+) than in Android Studio 4.0. It's just instant while in AS is freezing a lot. AS 4.1 is much better but still not perfect. Would switch to Intellij but it's not possible currently (or wasn't a two weeks back when testing) because of Android gradle 4.0 support.
a
Thanks for the update! That’s right, AS 4.1 is based on IJ 2020.1, while AS 4.0 on 2019.3. And some perf. improvements, including ones mentioned above, require IJ 2020.1+ We cooperate with Google on making the process of switching AS to a newer IJ as fast as possible.