Question

Does SBT make use of fsc?

For test purposes I am compiling a 500-line program on a fairly slow Ubuntu machine (Atom N270). Three successive compile times were 77s, 66s, and 66s.

I then compiled the file with fsc from the command line. Now my times were 80s, 25s, 18s. Better! That implies to me sbt is not using fsc. Am I right? If so, why doesn't it use it?

I may try getting sbt to explicitly use fsc to compile, though I am not sure I will figure out the config. Has anyone done this?

Was it helpful?

Solution

SBT cannot benefit from the Fast Scala Compiler when you run it interactively (with or without using its continuous build mode) because the Scala compiler classes are loaded and get "warmed up" and JIT-ed, which is the entirety of fsc's advantage.

OTHER TIPS

This discussion made me realize I have been using sbt the wrong way.

Instead of (from the command line):

$ sbt compile
$ sbt test

..one should keep sbt running and treat it as the command prompt.

$ sbt
> compile
  ...
> test

It has the command history and even ability to dive back into OS command line. I wrote this 'answer' for others like me (coming from a Makefile mindset) that might not realize we're taking the pill all wrong. :)

(It's still slow, though.)

At least for SBT 0.7.x the authors explain that it is not as fast as fsc, which caches the compiler instance (including the loaded libraries), rather than just the JITted compiler classes:

http://code.google.com/p/simple-build-tool/wiki/ChangeDetectionAndTesting

My experience also confirms that fsc is faster for full compiles, but does not automatically select what to recompile.

For SBT 0.10, I can find no docs whatsoever on this issue.

You don't need to do it anymore. Sbt has its own way now:

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top