Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tweaking SBT performance

Tags:

scala

sbt

Are there any SBT options, JVM options or Scala compiler options that would positively or negatively influence SBT's startup and compile time. What are the options that I can play around with? Documentation is very poor and doesn't specify anything.

Background: I switched from from a 2 year old Macbook Air to a brand new Macbook Pro. Same OS, same configuration. The new one, has a much faster CPU and twice as much memory. For some reason, starting SBT and compiling my Play2 application is significantly faster on my old, much weaker, machine. The difference is consistently as high as 10 seconds compile time.

like image 770
Daniel Lang Avatar asked Oct 16 '25 01:10

Daniel Lang


1 Answers

Turns out it was 2 things:

  • There was a conflicting dependency on SLF4J, which caused an SBT warning every time it started. I assume SBT tried to resolve the dependency in the background, significantly slowing down startup speed. Once that was removed, I saved 3-4 seconds.

  • When the compilation of the Play2 application was triggered by hitting http://localhost:9000 in the browser, there was another issue related to the hostname. I don't know exactly why this was having such a big impact, but after running scutil –set HostName “localhost” I reduced the time it takes to compile the application and get the Play2 application in the browser by nearly 10 seconds!

So overall, these 2 little changes saved me more than 10 seconds in the development cycle. I hope somebody finds this useful as well.

like image 140
Daniel Lang Avatar answered Oct 18 '25 20:10

Daniel Lang