What would cause Intellij to suddenly get really slow with scala? - performance

I have been using Intellij 12 to build a Play Framework 2 app for about a month. It's been fine up until yesterday. Now when ever I try to write code in one of the scala templates Intellij gets very very very slow. Like it takes 5-10 seconds to enter a couple new lines. What would cause this to start happening all of a sudden and how do I fix it?
I tried increasing my vm options to the following, but it didn't help:
-Xms256m
-Xmx800m
-XX:MaxPermSize=512m
-XX:ReservedCodeCacheSize=128m
-XX:+UseCodeCacheFlushing
-XX:+UseCompressedOops
Edit: Could a recent Intellij or plugin update have destroyed performance?
Edit: I updated my Scala and Play plugins and it didn't help.

FYI..
Try to update to new version (0.2.16)
http://plugins.jetbrains.com/plugin?pluginId=7080

I had a similar problem, switching to sun java from openjdk fixed it. Also check if it isn't doing something in the background like indexing or sth like that. Just a guess. Cheers!
Edit: google-fu resulted in one potencionally interesting fact. A lot of scala users are experiencing this. It looks that scala is only available in intellij 12 and this is a first version, so it's probably a problem on the side of scala devs.. if I manage to find a workaround I'll post it here. Brace for scala updates until then ;)

Related

Maven & InventoryClickEvent.getClickedInventory();

Whilst coding a fun new trash can for a Minecraft server network that I develop for, I came across a pretty strange, and therefore infuriating, bug concerning Maven. I've been using it for a year or two now and have only gotten a single build error before, when I first started using it. Suddenly, this problem has shown itself.
The red arrows indicate the lines that are causing the build failure.
This is a screenshot of the Maven logs that are causing the issue.
Well, according to the Bukkit API docs (note that the official docs seem to be down, thus third party), the class InventoryClickEvent has no method getClickedInventory().
This fact definitely explains your compilation error. The error comes from your Java compiler, Maven has nothing to do with it.

Extremely long build with Gradle (Android Studio)

right now we are in a situation of having build times 2 minutes 30 seconds for very simple change. This (compared to ANT) is amazingly slow and is killing the productivity of the whole team.
I am using Android Studio and using the "Use local gradle distribution".
I've tried to give more memory to gradle:
org.gradle.jvmargs=-Xmx6096m -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
A lot more memory. AND IT IS STILL GIVING ERRORS FOR MEMORY from time to time.
Exception in thread "pool-1-thread-1" java.lang.OutOfMemoryError: GC overhead limit exceeded
Amazing. I am using the parallel option and daemon:
org.gradle.parallel=true
org.gradle.daemon=true
It doesn't really help.
I've put the aforementioned parameters in ~/.gradle/gradle.properties (and I even doubted that Android studio is ignoring that, so I tested - it is not ignoring it).
Still from terminal I get 1:30 build time vs 2:30 in Android Studio, so not sure what is wrong there. 1:30 is STILL CRAZY compared to Ant. If you know what Android Studio is doing (or ignoring, or rewriting as gradle config), I'd be grateful to know.
So just CMD + B (simple compile) is super fast after changes, like 7 seconds.
But when it comes to running the app, it starts the task dexXxxDebug, which is just killing us.
I've tried putting
dexOptions {
preDexLibraries = false
}
Doesn't help.
I understand that gradle is probably still not ready for production environments, but I'm starting to regret our decision to move so early to it.
We have lots of modules, which is probably part of the problem, but that was not an issue with Ant.
Any help appreciated,
Dan
Some more information about execution times:
Description Duration
Total Build Time 1m36.57s
Startup 0.544s
Settings and BuildSrc 0.026s
Loading Projects 0.027s
Configuring Projects 0.889s
Task Execution 1m36.70s
The time eater:
:app:dexDebug 1m16.46s
I'm not quite sure why Android Studio is slower than the command line, but you can speed up your builds by turning on incremental dexing. In your module's build file, add this option to your android block:
dexOptions {
incremental true
}
In that dexOptions block you can also specify the heap size for the dex process, for example:
dexOptions {
incremental true
javaMaxHeapSize "4g"
}
These options are taken from a thread on the adt-dev mailing list (https://groups.google.com/forum/#!topic/adt-dev/r4p-sBLl7DQ) which has a little more context.
Our team was facing the same issue.
Our project exceeds the method limit for dex(>65k).
So, in out library project we put below options in build.gradle:
dexOptions {
jumboMode = true
preDexLibraries = false
}
In our project build.gradle:
dexOptions {
jumboMode = true
// incremental true
}
previously we had incremental true. after commenting it its taking around 20s to run as compared to 2mins 30 seconds.
I don't know this may solve your problem. but it can help to others. :)
Disclaimer: This isn't a solution - it's a statement that there is no solution with relevant link sources to prove it.
Since all answers here do not solve a problem that has been lingering since 2014, I'm gonna go ahead and post a couple of links which describe a very simillar problem and present OS-specific tweaks that might or might not help, since OP did not seem to specify it, and solutions vary a lot across them.
First is the actual AOSP bug-tracker issue referring to parallelization, with a lot of relevant stuff, still open and still with a lot of people complaining as off version 2.2.1. I like the guy who notes the issue (a high-priotity one at that) id including "666" not being a coincidence. The way most people describe music programs and mouse movement stuttering during builds feels like looking into a mirror...
You should note people report good stuff with process lasso for Windows, while I see none really reporting anything good with renice'ing or cpu-limiting in *nix variants.
This guy (who states he doesn't use gradle) actually presents some very nice stuff in Ask Ubuntu, that unfortunately doesn't work in my case.
Here is another alternative that limits threads of gradle execution, but that didn't really improve in my scenario probably due to what somebody says on another link about studio spawning multiple gradle instances (while the parameter only affects one instance's parallelism).
Note that this all goes back to the original "666", high-priority issue...
Personally I couldn't test many of the solutions because I work on a managed (no root privs) Ubuntu machine and can't apt-get/renice, but I can tell you I have an i7-4770, 8GB RAM and a hybrid SSD, and I have this problem even after a lot of memory and gradle tweaks over the years. It is a tantalizing issue, and I can't understand how Google hasn't committed the necessary human resources to the gradle project to fix something that is at the core of development for the most important platform they build.
One thing to note on my environment is: I work in a multi-dependency studio project, with about 10 subprojects, all of them building on their own and filling up the gradle pipeline.
When passing a value, you can append the letter 'k' to indicate kilobytes, 'm' to indicate megabytes, or 'g' to indicate gigabytes.
'--offline' solved my problem.

Did the Mac OS X Java update to 1.5u7 whack my 1.6.0 laf.jar?

This is the update that just came out this week (2010-05-18).
Somebody moved my cheese. It appears that laf.jar is look and feel, so it is probably not a big deal for my Java development. Eclipse got mad about the missing JAR file, and furthermore thinks the 1.6.0 VM disappeared, which it didn't. I had to redefine the VM library within Eclipse and everything appears kosher, but I was hoping somebody with more hit points than me could say so definitively. Am I all good? Was it really the Mac OS X update for 1.5 that went and hunted down a file in my 1.6 VM?
I haven't been able to google anything about this... If somebody could post a link to some information about this, that'd be appreciated too.
I've had the same problem. Eclipse complained that there were classes missing in laf.jar. I've done basically the same thing: I went to Preferences-->Java-->Installed JREs . When I clicked on it Eclipse told me that it could not find the JVM 1.6 at the specified path and removed it. I then told Eclipse to search for existing JVMs. It found (of course) 1.6. The error in laf.jar disappeared and Eclipse did not complain anymore.

Scala Eclipse IDE suddenly ignoring breakpoints

I've been using Scala 2.8RC1 and Scala Eclipse plugin for 2.8 RC1 happily for a few days. However, last night after adding a couple jar files to my environment (apache http client jars) the debugger just stopped stopping at breakpoints in scala code.
Java code stops fine at breakpoints. I tried creating a new mimimal scala app breakpoints don't stop. I've tried switching to sun-jre-1.6.0.20 from the openjdk-1.6.18 I had been using. I've switched to the scala 2.8 nightly and also eclipse plugin for scala nightly builds. No luck.
I would greatly appreciate ideas for fixes. Rather frustrating as the initial experience with 2.8 was really great.
https://www.assembla.com/spaces/scala-ide/tickets/2731-breakpoints-against-objects-in-default-package-are-not-honoured
Says that scala eclipse plugin doesn't stop at breakpoints if you're class is in the default package (no package)
Adding a package and moving my class to it - make the debugger start working again.
It's possible that you've discovered a bug in the Scala tooling for Eclipse. The best place to take the issue is the scala-ide-user list here,
http://groups.google.com/group/scala-ide-user
If you're already sure that you've found a bug you can find instructions for opening a ticket here,
http://scala-ide.assembla.com/wiki/show/scala-ide/Bug_Reporting
I've just encountered this problem. Code is not in default package. I'm getting a warning about missing line numbers, but apparently that bug has been fixed and I can ignore the warning, per https://scala-ide-portfolio.assembla.com/spaces/scala-ide/tickets/1000155-its-impossible-to-add-line-numbers-debug-info-to-compiled-project#/activity/ticket:
It did seem to stop at breakpoints in the main file, though.

Avoiding Groovy/Grails internals while debugging in IntelliJ Idea

I'm using IntelliJ Idea 8.1.2 for Grails development. The dynamic nature of Groovy is giving me a hard time debugging my code: I keep ending up in the internals of Groovy/Grails, i.e. CachedMethod, ExpandoMetaClass or the like.
Is there a way for example to tell the Idea debugger to completely skip the Groovy/Grails internals while debugging and only make steps in my own code? I did notice that there is a configuration option named "Do not step into specific Groovy classes" in Debugger > Groovy but so far I've noticed no difference.
If not, what is your workaround or how do you cope with the situation? Any help would be greatly appreciated.
File->Settings->Debugger->Stepping
Do not step into the classes...
Yeah, I suffer with this annoyance, too, and I don't have a good solution. My workaround once I'm lost in Groovy/Grails code is just to figure out where I should be back in my code, set a break point there, and hit Continue.

Resources