Article Discussion
How the Use of Scala's Features Affects Compile Time
Summary: The compiletime project is an attempt to better understand the relationship between the use of Scala's features and compile time. This article gives a quick overview of what we've learned so far.
7 posts on 1 page.      
« Previous 1 Next »
The ability to add new comments in this discussion is temporarily disabled.
Most recent reply: February 14, 2013 0:50 AM by Channing
Bill
Posts: 408 / Nickname: bv / Registered: January 17, 2002 4:28 PM
How the Use of Scala's Features Affects Compile Time
February 11, 2013 10:00 PM      
The compiletime project is an attempt to better understand the relationship between the use of Scala's features and compile time. This article gives a quick overview of what we've learned so far.

http://www.artima.com/articles/compile_time.html
Eric
Posts: 3 / Nickname: etorreborr / Registered: October 23, 2007 0:40 PM
Re: How the Use of Scala's Features Affects Compile Time
February 12, 2013 0:50 PM      
Thanks Bill for this very detailed post. I can confirm that the effect of using an abstract class instead of a trait is a dramatic improvement for specs2 (from 225s to compile the full project to 133s).

About the comparison of the matchers and the effect of having a double by-name in specs2, it'd be nice to measure specs2 again with "1 + 1 must beEqualTo(2)" instead of "1 + 1 must be equalTo(2)" because in the second case there's one more implicit being called.

E.
Channing
Posts: 8 / Nickname: channing / Registered: May 14, 2003 11:45 PM
Re: How the Use of Scala's Features Affects Compile Time
February 12, 2013 1:28 PM      
How are you doing that Eric? Is it just a case of creating a new abstract class extending Specification, or do mean changing Specification to be abstract?

Channing
Bill
Posts: 408 / Nickname: bv / Registered: January 17, 2002 4:28 PM
Re: How the Use of Scala's Features Affects Compile Time
February 12, 2013 2:45 PM      
> Thanks Bill for this very detailed post. I can confirm
> that the effect of using an abstract class instead of a
> trait is a dramatic improvement for specs2 (from 225s to
> compile the full project to 133s).
>
That's an awesome improvement. Is that about a half second per test class? Because that's what the results would have predicted.

> About the comparison of the matchers and the effect of
> having a double by-name in specs2, it'd be nice to measure
> specs2 again with "1 + 1 must beEqualTo(2)" instead of "1
> + 1 must be equalTo(2)" because in the second case there's
> one more implicit being called.
>
Can you do a pull request on the compiletime project? I didn't realize there was a beEqualTo.

Bill
Eric
Posts: 3 / Nickname: etorreborr / Registered: October 23, 2007 0:40 PM
Re: How the Use of Scala's Features Affects Compile Time
February 13, 2013 4:22 PM      
I did what Bill recommended: changed Specification to SpecificationLike and added "abstract class Specification extends SpecificationLike". I also re-published specs2 1.12.4-SNAPSHOT (for scala 2.9.2) and 1.13.1-SNAPSHOT (for scala 2.10) so if you use one of those 2 you should see some improvement.
Eric
Posts: 3 / Nickname: etorreborr / Registered: October 23, 2007 0:40 PM
Re: How the Use of Scala's Features Affects Compile Time
February 13, 2013 4:30 PM      
Yes, that's approximately that:

- 176 test classes / 2 = 88
- 225 - 133 = 92

It's interesting to see that it is that predictable. That'd be interesting to see which other projects in the community are compiling lots of entities to traits and would benefit from this.

> Can you do a pull request on the compiletime project? I didn't realize there was a beEqualTo.

I just did.

E.
Channing
Posts: 8 / Nickname: channing / Registered: May 14, 2003 11:45 PM
Re: How the Use of Scala's Features Affects Compile Time
February 14, 2013 0:50 AM      
Fantastic
7 posts on 1 page.
« Previous 1 Next »