Secret sauce to compile time improvement

178 views
Skip to first unread message

virtualeyes

unread,
May 3, 2012, 10:56:40 AM5/3/12
to simple-b...@googlegroups.com
I just upgraded to JDK 1.7 64-bit along with bleeding edge Eclipse 4.2 M6, Scala IDE 2.1 M1 and Scala 2.9.3

A project clean (90 scala and 17 java files) takes @10 seconds, pretty fast, no?

With the same project, running "sbt clean" followed by "> compile" from terminal prompt is predictably slower, anywhere from 40 to 60 seconds.

Running "sbt", followed by "> clean", "> compile" trims compile time down to @25 seconds, and subsequent clean, compiles to no faster than 17 seconds, which is decent, but not what I'm getting in the above setup.

The primary difference I see is that I use IvyDE, and when I "deliver-local" from sbt, the generated ivy.xml file seems to be following a kitchen sink approach: "compile,runtime,test,provided,optional,sources,docs,pom"; changing the ivyDE config in Eclipse to just, "compile,runtime,test,provided" sped build times up drastically, literally 3X faster. What are the sbt compilation defaults and is there any way to tweak them? That's the secret sauce I'm after (if it exists)

Secondarily, due to a dependency issue I am forced to use Scala 2.9.1 to build sbt projects, whereas Scala IDE 2.1 comes with Scala 2.9.3

Side note: the black magic that is JVM opts trial & error had zero noticeable impact, or at least no improvement (some settings did manage to bring compilation times to a grinding crawl, so I am convinced they have an impact, just not on the plus side of the fence).

System is, BTW, Fedora 14, quad core, 8gb ram, SSD

Thanks for any tips on how to get sbt compile times inline with Eclipse!


Daniel Sobral

unread,
May 3, 2012, 11:11:19 AM5/3/12
to simple-b...@googlegroups.com
On Thu, May 3, 2012 at 11:56 AM, virtualeyes <sit...@gmail.com> wrote:
>
> Secondarily, due to a dependency issue I am forced to use Scala 2.9.1 to
> build sbt projects, whereas Scala IDE 2.1 comes with Scala 2.9.3

Libraries compiled for 2.9.1 _ought_ to work with 2.9.2. There's no
Scala 2.9.3, nor is there anything committed on the 2.9.x branch
that's newer than 2.9.2.

--
Daniel C. Sobral

I travel to the future all the time.

virtualeyes

unread,
May 3, 2012, 11:28:03 AM5/3/12
to simple-b...@googlegroups.com
Ok, Scala 2.9.3-20120418-132-013 is what displays in Scala IDE 2.1 M1 as the Scala library

Perhaps a typo on their part, at any rate, it's not 2.9.1 which is what sbt is currently building against.

Libs compiled on 2.9.1 may in fact work on 2.9.2, but when sbt insists on appending scala-version to the target artifact, then the build fails as, in my case, grizzled-slf4j-2.9.2 does not yet exist in the repo

virtualeyes

unread,
May 3, 2012, 12:52:20 PM5/3/12
to simple-b...@googlegroups.com

Scala IDE 2.1 M1 shows Scala 2.9.3 as the Scala library, must be a typo on their part.

Just now I managed to build against 2.9.2 by manually specifying the url of the jar of the as-yet-to-be-2.9.2'd grizzled-slf4j library, which was what was keeping me on 2.9.1

Build times were initially consistently much slower on 2.9.2, even with successive clean, compiles from sbt prompt; fastest I could get was 37 seconds.

Experimenting, I tried
scalaHome := Some(file("/path/to/2.9.2/"))
offline := true
crossPaths := false

and that remained dog slow; however, removing scalaHome produced the secret sauce, 10 second clean, compile, yes! ;-)

So, build times can be relatively fast in both eclipse and sbt, just requires some tweaking....




On Thursday, May 3, 2012 5:11:19 PM UTC+2, Daniel Sobral wrote:

Daniel Sobral

unread,
May 3, 2012, 1:12:19 PM5/3/12
to simple-b...@googlegroups.com
On Thu, May 3, 2012 at 12:28 PM, virtualeyes <sit...@gmail.com> wrote:
> Ok, Scala 2.9.3-20120418-132-013 is what displays in Scala IDE 2.1 M1 as the
> Scala library
>
> Perhaps a typo on their part, at any rate, it's not 2.9.1 which is what sbt
> is currently building against.
>
> Libs compiled on 2.9.1 may in fact work on 2.9.2, but when sbt insists on
> appending scala-version to the target artifact, then the build fails as, in
> my case, grizzled-slf4j-2.9.2 does not yet exist in the repo

SBT doesn't insist on anything. If you use "%%", it appends the
version. If you don't, it doesn't. So don't, and specify 2.9.1
yourself.

>
>
>
> On Thursday, May 3, 2012 5:11:19 PM UTC+2, Daniel Sobral wrote:
>>
>> On Thu, May 3, 2012 at 11:56 AM, virtualeyes <sit...@gmail.com> wrote:
>> >
>> > Secondarily, due to a dependency issue I am forced to use Scala 2.9.1 to
>> > build sbt projects, whereas Scala IDE 2.1 comes with Scala 2.9.3
>>
>> Libraries compiled for 2.9.1 _ought_ to work with 2.9.2. There's no
>> Scala 2.9.3, nor is there anything committed on the 2.9.x branch
>> that's newer than 2.9.2.
>>
>> --
>> Daniel C. Sobral
>>
>> I travel to the future all the time.
>
> --
> You received this message because you are subscribed to the Google Groups
> "simple-build-tool" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/simple-build-tool/-/D2VE7O5eHPkJ.
>
> To post to this group, send email to simple-b...@googlegroups.com.
> To unsubscribe from this group, send email to
> simple-build-t...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/simple-build-tool?hl=en.

Paul Phillips

unread,
May 3, 2012, 1:26:20 PM5/3/12
to simple-b...@googlegroups.com
It isn't a typo. If it said 2.9.3-SNAPSHOT you would perhaps find its
meaning more apparent. It is unfortunate for everyone that versioning
things in a way that matches everyone's beliefs (both humans and their
robotic assistants) about versions is so difficult; but really, it is.

virtualeyes

unread,
May 3, 2012, 2:54:40 PM5/3/12
to simple-b...@googlegroups.com
Given that 2.9.2 was only released a couple of weeks ago, no, I did not expect 2.9.3 stable to be shipped with M1 of Scala IDE 2.10

At any rate, the setup is bleeding edge and somehow it all works rather well so far; next is throwing Scala 2.10 into the mix...

Thanks, btw, Paul, for driving the Scala compiler bus; we're in for a fun ride with 2.10 ;-)

Paul Phillips

unread,
May 3, 2012, 3:41:10 PM5/3/12
to simple-b...@googlegroups.com
On Thu, May 3, 2012 at 11:54 AM, virtualeyes <sit...@gmail.com> wrote:
> Thanks, btw, Paul, for driving the Scala compiler bus; we're in for a fun
> ride with 2.10 ;-)

If it's a bus, it's the bus from "Speed", and I think I have a better
chance at Dennis Hopper's role than Keanu's.

virtualeyes

unread,
May 3, 2012, 4:20:19 PM5/3/12
to simple-b...@googlegroups.com
You would no better than anyone, or perhaps anyone not named Odersky, which bus we're on and where we're headed with the Scala Express.

As a passenger I am seriously enjoying the ride...
Reply all
Reply to author
Forward
0 new messages