Real FSC support

Usual Scala compilation never seems fast enough. There are two main reasons why:

  • It takes a lot of time to start Scala compiler and to process standard libraries.
  • Scala compiler doesn’t support selective recompilation.

The first problem is solved by FSC (Fast Scala Compiler). FSC runs a compilation daemon to avoid subsequent compiler instantiations (at the price of increased memory usage).

However, FSC still re-compiles everything you throw at it (usually – the whole project, even if you’ve changed a single file). To speed up compilation further, we need to use a selective recompilation, that is provided only by third-party tools (like SBT or IDE).

So, the combination of IDEA and FSC can provide lightning-fast Scala compilation.

Scala plugin has been supporting FSC for a long time. Kind of… It was hard to configure and use FSC, settings was vague and compilation daemon was … you know, uncontrollable. Now that things have changed.

We can setup either internal FSC server (per project) or external (possibly remote) one:

Then we may use that server in any module we want:

So we can mix FSC with ordinary Scala compilers (when there are multiple versions of Scala used or when we need special compilation settings for some modules).

IDEA automatically manages internal FSC servers – it starts an instance when needed and stops it on application exit (or project close). Additionally, we can manually start, stop or reset compilation daemon using a menu on FSC status icon:

Besides FSC status icon (a little gear-gauge in the status bar) we are receiving notifications on FSC events:

P. S. Mac users may need to configure the OS X firewall for FSC communication.

About Pavel Fatin

Programming enthusiast, technology advocate. IntelliJ Scala plugin developer at JetBrains,
This entry was posted in Uncategorized. Bookmark the permalink.

12 Responses to Real FSC support

  1. Christian says:

    that is great news.
    Tried it out, it is extremely fast compared to before.


  2. Eric P says:

    Scala 2.8.1 didn’t work (compile just hung) but after upgrading my project to 2.9.1 it worked great. Thanks! This is huge.

  3. Srirangan says:

    Just what I needed for my current project, thanks!

  4. Adam Warski says:

    Works great! Finally an easily useable FSC :) Thanks for that update.

    Now if only autocomplete was faster … 😉


  5. Perfect! This is really big improvement.

  6. Jan Kotek says:

    Perfect. How did you dealt with FSC exiting after half hour of inactivity?

  7. Sam Hendley says:

    I just tried FSC with intellij and found an issue with the compilation, I wasn’t sure where to post it so I made a ticket on main bug tracker

    Bascially “type aliases” dont seem to work in all cases. That sucks because the build was running much faster until these errors. Thanks

  8. Works like a charm, I haven’t even noticed the compilation prior to running tests after a change, finally! Thank you!

  9. Andrew says:

    I’m finding it impossible to get rid of the “Compiler internal error. Process terminated with exit code 1” error. Non-fsc compile works fine. idea.log has nothing useful in it. I’m on IntelliJ 10.5.2 with Scala plugin 0.4.1440. My project appears to be identically configured to that of a coworker who is using fsc just fine. I’m on Windows, he’s on OSX.

    There is nothing on the net that offers any answers. Any advice?

  10. Works great with Scala 2.9.1. Really accelerates the development.


  11. Andrew Bate says:

    I have wasted two hours trying to get this to work properly. Bottom line: support is still patchy at best.

  12. James says:

    It work fine on my machine with W7. Amazing! Never seem a compiler could be so fast when Scala is productivity at best!

Leave a Reply

Your email address will not be published. Required fields are marked *