How to speed up Scala IDE?
Asked Answered
M

6

6

I'm working with a fairly large project, managed by SBT (full recompilation time 150+ sec). I'm using latest Scala IDE plugin (4.0.0-M1) and I can barely edit any large enough source file - each time I type something, eclipse freezes completely for a couple of seconds. Same happens when I save my changes. It also seems that editing file cause more and more heavy performance degrade. Restarting Eclipse helps, but not for long. To work this around, I have to open a .scala source file in text editor via Eclipse, losing all benefits of Scala editor.

Additional info

PC is good enough - Intel Core i5-3570 with 16 GB RAM

I'm using Windows 7 x64, Scala 2.10.3, SBT 0.13.1 and Oracle JDK 1.7.0u45

Using profiling with Java VisualVM shows that apparently CPU is used by Scala presentation compiler: Java VisualVM output

Eclipse's heap status indicator never goes beyond a half.

Auto-build, implicits highlight and mark occurences are all turned off

Configuration from eclipse.ini (3 last flags are added from http://scala-ide.org/docs/current-user-doc/advancedsetup/index.html):

-vm
D:\ProgramFiles\Java\jdk1.7.0_45\bin\javaw.exe
-vmargs
-Dosgi.requiredJavaVersion=1.6
-Xms1024m
-Xmx2048m
-Xss1M
-XX:MaxPermSize=1024M
-server
-XX:+DoEscapeAnalysis
-XX:+UseConcMarkSweepGC
-XX:+UseCompressedOops
Mcginn answered 30/4, 2014 at 7:13 Comment(4)
Neither. Just a simple humour. Nothing to get so upset about !Rosalbarosalee
If it helps, I have this exact same problem; no answers yet unfortunately, I'm using IDEA until this gets ironed out (hopefully soon).Inscription
The easiest way to debug performance issues like this one is to use svelto. This will automatically dump threads when the UI thread is hogged. Then please follow up on the scala-ide-dev mailing list.Rambouillet
Thanks Iulian! I've created a ticket assembla.com/spaces/scala-ide/support/tickets/1002129 and posted a message in that mailing list (not yet approved)Mcginn
R
4

For posterity. The culprit was the Mylyn plugin trying to find out precise information on what's under the cursor on every keystroke and on the UI thread. For details, see ticket #1002129.

Rambouillet answered 3/7, 2014 at 8:2 Comment(0)
I
3

I haven't tried the new Scala Eclipse IDE, but my opts were -Xms2g -Xmx8g one year back. I was using it for a sizeable, but not huge, project on a Mac i7quad/8GB and yet it was slow...

Eventually I decided to compile only upon saving the file.

So maybe you should try those:

  • increase the heap size as above
  • try the -d64 option, if it exists on your platform
  • uncheck the checkbox "Report problems as you type" (Preferences > Java > Editor)

for the last one, how and whether that disables the presentation compiler, I'm not sure; but that certainly doesn't invoke it as much.

Intermigration answered 30/4, 2014 at 9:4 Comment(4)
Can please describe how to disable presentation compiler in Scala IDE?Mcginn
It seems like -d64 and increasing heap size really helped, thanks! Unchecking "Report problems as you type" is even better, but previous two seems to be enough for me to work without big discomfort.Mcginn
Does it? So it seems that the Scala IDE plugin did improve, in the past year :)Intermigration
To my regret, this effect is temporary - the longer I edit the file, the slower it becomes. Restarting Eclipse resets the slowness.Mcginn
C
2

If the presentation compiler is taking such a long time, the source of the slowdown might be in your code rather than in the tools working on it.

Diverging implicits are sometimes the culprit for type checking timings becoming humongous. Have you tried compiling with Xlog-implicits ? You may also want to use IDE features to mark implicit usage in your code.

Continent answered 30/4, 2014 at 9:18 Comment(1)
I really do have a fair amount of implicits conversions and arguments (about 200 in the file I'm working with now), but that doesn't sound like a good reason to freeze the editor in the middle of something.Mcginn
P
1

Try intellij community (not a sassy answer). It runs faster than Eclipse. Also, even in intelliJ I have to split up files sometimes when they become too large for the IDE.

Photina answered 30/4, 2014 at 8:13 Comment(2)
I didn't have that opportunity yet, but my pals also told me they were happy with it. For smaller codebases, though, I like jEdit, which has a fair support of the Scala syntax highlighting; and because I don't dislike using sbt from the command-line, now.Intermigration
I've used Eclipse for over 4 years, and switching to IDEA now will hinder my productivity even more. Thanks for the tip though, I'll look into it later.Mcginn
E
1

You can disable automatic building. In the menu, uncheck Project > Build Automatically.

Every time you save a source file Eclipse will save your file but won't try to build the workspace as it would if this option were checked.

To force a build, press Ctrl-B or Cmd-B on a Mac. If you use the problems view, there are 2 classes of problems - ones that require saving, and ones that require saving + recompilation. So, if you see that a problem is not going away after a save, but you believe it should no longer be a problem, just rebuild.

This is what I did in Eclipse when developing big Java projects before SSDs and multi-core processors.

Enfranchise answered 15/11, 2015 at 21:56 Comment(0)
S
0

With the default recommended configuration, I just uninstall the "code recommendation" plugin and revert "Auto activation triggers for java" to only a ".".It runs much faster now.

Searle answered 26/3, 2015 at 6:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.