I’m currently tracing through a relatively small Scala program (Apache’s Kafka) with IntelliJ 10.5.4, while at the same time running several other Java applications in another project. While the Java applications are doing just fine, the Scala debugging is horribly slow, a simple “Make Project” will take easily 2 minutes, and even basic cursor keystrokes take up to a second each to reflect on the screen.
I’ve used IntelliJ before with as many as 6 applications running at the same time, under multiple projects, and it doesn’t have any problems at all. Hardware isn’t an issue either, this is all running on a very recent Macbook Pro (256GB SSD, 8Gb RAM, quad-core i7), under Java 1.6.0_31.
Are there any tips/tricks to making Scala perform decently while debugging under IntelliJ? Alternatively, what are people out there using for Scala debugging?
tl;dr
re: compile times, do you have FSC enabled? This dramatically helps Scala compile times.
re: overall slowness, you probably need to tweak your JVM settings. Scala can be more memory intensive, so you may have to increase your
-Xmxvalue to spend less time garbage collecting. Or lower it, if it’s too dramatically high. Or change the garbage collector. For reference, here are mine:Actually figuring it out
You will probably have to do some profiling to find out what the performance problem actually is. The simplest thing to start with would be to open Activity Monitor to see if memory is low, CPU utilization is high, or disk activity is high. This will at least give you a clue as to what’s going on. You have an SSD, so disk I/O is probably not a problem.
You may need to profile IDEA itself, such as running it with YourKit Java Profiler. This could tell you something interesting, such as if IDEA is spending an excessive amount of time garbage collecting.
In general, though, Scala seems a bit more memory intensive than Java on IntelliJ. It’s possible that you have
-Xmxset too low, causing excessive garbage collections. Or maybe it’s set too high, so that when it does garbage collect, you get a pauses in the app. Changing which collector your using may help with that, but with all the collectors there’s a point of diminishing returns where setting-Xmxtoo high causes performance problems.