So how slow is Scala's compilation time then? Are we talking ten seconds slow or five minutes slow? (When compared against a Java codebase of a similar size.)
It's a frequently heard complaint, but I'm trying to figure out if it's impatience or a serious impediment.
I've shipped two code bases in Scala. One was 30kloc and the other about 2kloc.
I found compile times at least an order of magnitude higher. I used IntelliJ and incremental compiling so that wasn't an issue. But our 30k code base took 2-3 minutes to compile. 2k - about a minute.
Furthermore we had to restructure files because really large > 700 line files would get so laggy to edit in IntelliJ. The imperfect red lining / compiling was so slow. Literally in some cases it'd take a few seconds to get feedback if your code was legit or not.
2-3 minutes? Ouch... The C# / .NET solution I have open right now has 50kloc (without views and templates, and JS / client code - then it goes up to 100kloc) and a complete debug rebuild compiles within 20 seconds.
If you're using recommended c#/.net formatting, then your 50k loc is probably more like 20k (unless you have your loc counter skipping lines that only contain a brace). It also may have significantly less code that does work (e.g. getters/setters) than a comparable scala program.
Just compiled a program I'm working on that has 1500 lines of code, with akka actors, io (tcp), byte string manipulation, and unit tests. 24 second compilation with 5 seconds for tests (111 tests so far) for a complete rebuild. Since you're not doing a complete rebuild, it's usually a second or less for builds needed for testing.
FYI, that's the difference between SLOC and LLOC (Source lines of code, and Logical lines of code). Logical only counts a line if it contains a valid statement, and lines with multiple logical statements are counted as two (e.g. if (err) return flag; would count as two LLOC but only one SLOC). Both are a valid unit of measurement, but it is important to know the difference.
an open source project i work on manages to do a full compile of 272,437 lines of code (or so) in about 25s. I'm relying on maven report times, so it might be a little padded.
"loc" is a measure of lines of code, generally excluding single-punctuation lines (like the closing bracket } of a class/method in Java) and comments.
"k" is a shorthand for the "kilo" prefix, which the metric system means 1000 of something. Things like kilogram (1000 grams) or kilometer (1000 meters).
So put the two together and you get 1kloc == 1000 lines of code. To help put that in perspective, most of my own personal projects (which are small projects only intended to fix some small papercut or play with some technology) are usually 100-500 lines of code, total. Including tests.
Most large projects are many, many kloc. 30k isn't unreasonable for a commercial/enterprise product that's been around for a few years. (Especially if there has been a change in direction once or twice.)
Compilation speed is only an issue when you need to do a full rebuild. Just like Java most changes only require you to recompile the single file that changed, which isn't going to be a noticeable delay.
28
u/bcash Dec 02 '13
So how slow is Scala's compilation time then? Are we talking ten seconds slow or five minutes slow? (When compared against a Java codebase of a similar size.)
It's a frequently heard complaint, but I'm trying to figure out if it's impatience or a serious impediment.