Pages

Saturday, July 2, 2011

Enable fast Scala compiler (fsc) on IntelliJ IDEA

Regular compilation with Scala compiler is really slow. Most of the time is spent compiling parts of Scala libraries, instead of your own code though. Solution is to use fsc (fast scala compiler), which is daemon that compiles the required Scala libraries on the first compilation, and stays in memory after that, so your subsequent compilations after a lot faster.

My first guess was to just click the checkbox “Use fsc” in the Scala plugin settings page. This alone only causes exceptions. You also need to create a Scala compilation server instance for yourself.

  1. Open the 'Edit (Run/Debug) Configurations' dialogimage
  2. Click on the [+] in left top corner of the window
  3. Select 'Scala Compilation Server' (should be near the end of the list) 
  4. Give the new launcher a name (e.g. 'my fsc server') and hit OK
  5. Press the Play icon to compile and run as usual.

Your second press of Play should be a lot faster!

No comments:

Post a Comment