The Artima Developer Community
Sponsored Link

Articles Forum
How the Use of Scala's Features Affects Compile Time

6 replies on 1 page. Most recent reply: Feb 14, 2013 12:50 AM by Channing Walton

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 6 replies on 1 page
Bill Venners

Posts: 2284
Nickname: bv
Registered: Jan, 2002

How the Use of Scala's Features Affects Compile Time Posted: Feb 11, 2013 10:00 PM
Reply to this message Reply
Advertisement
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 Torreborre

Posts: 36
Nickname: etorreborr
Registered: Oct, 2007

Re: How the Use of Scala's Features Affects Compile Time Posted: Feb 12, 2013 12:50 PM
Reply to this message Reply
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 Walton

Posts: 32
Nickname: channing
Registered: May, 2003

Re: How the Use of Scala's Features Affects Compile Time Posted: Feb 12, 2013 1:28 PM
Reply to this message Reply
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 Venners

Posts: 2284
Nickname: bv
Registered: Jan, 2002

Re: How the Use of Scala's Features Affects Compile Time Posted: Feb 12, 2013 2:45 PM
Reply to this message Reply
> 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 Torreborre

Posts: 36
Nickname: etorreborr
Registered: Oct, 2007

Re: How the Use of Scala's Features Affects Compile Time Posted: Feb 13, 2013 4:22 PM
Reply to this message Reply
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 Torreborre

Posts: 36
Nickname: etorreborr
Registered: Oct, 2007

Re: How the Use of Scala's Features Affects Compile Time Posted: Feb 13, 2013 4:30 PM
Reply to this message Reply
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 Walton

Posts: 32
Nickname: channing
Registered: May, 2003

Re: How the Use of Scala's Features Affects Compile Time Posted: Feb 14, 2013 12:50 AM
Reply to this message Reply
Fantastic

Flat View: This topic has 6 replies on 1 page
Topic: Borachio: Mock Objects for Scala and Android Previous Topic   Next Topic Topic: Getting Started with Play 2, Scala, and Squeryl

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use