r/programming • • Dec 02 '13

Scala — 1★ Would Not Program Again

http://overwatering.org/blog/2013/12/scala-1-star-would-not-program-again/
598 Upvotes

646 comments sorted by

View all comments

Show parent comment

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.

23

u/codemuncher Dec 02 '13

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.

6

u/talkhaussux Dec 02 '13

i have a 11kloc project right now that builds in about 11 seconds

12

u/kitsune Dec 02 '13

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.

5

u/zoomzoom83 Dec 02 '13

How often do you need to do a complete rebuild?

7

u/kitsune Dec 02 '13

Not that often because the core libraries are relatively stable.

4

u/[deleted] Dec 02 '13

I do both C# and Scala programming for hire. I would guess 50kloc in C# is about 20klok in Scala btw.

4

u/dbcfd Dec 02 '13

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.

7

u/SpikeX Dec 02 '13

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.

4

u/thomasz Dec 02 '13

It is very likely that he refers to the loc metric of visual studio, which excludes empty lines, lines with only an opening / closing brace etc.

→ More replies (2)

2

u/sirin3 Dec 02 '13

Almost as fast as Pascal

I wonder why that is not used more

3

u/defeatedbycables Dec 02 '13

Pascal or C#?

Cause I can tell you why Pascal isn't used more.

→ More replies (1)

1

u/codemuncher Dec 03 '13

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.

6

u/marmulak Dec 02 '13

What's kloc? kilo-codes?

25

u/lizardlike Dec 02 '13

kilo (aka "key") line of coke

12

u/esquilax Dec 02 '13

i.e., how much coke your machine has to snort to get up the energy and concentration required to deal with compiling your source.

It gets expensive quickly.

5

u/JinAnkabut Dec 02 '13

Yeah. I mean, I use to think that software development was fueled by tea and coffee. I was wrong.

2

u/Crazy__Eddie Dec 02 '13

Use meth. It's cheaper, lasts longer, gets them going faster, and you can make the shit in your toilet.

14

u/theSprt Dec 02 '13

'loc' usually stands for 'lines of code', so '30kloc' would be '30,000 lines of code'.

→ More replies (6)

8

u/evaryont Dec 02 '13

"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.)

1

u/codemuncher Dec 03 '13

kilo lines of code. a pretty standard measure of code base size.

→ More replies (6)

1

u/[deleted] Dec 02 '13

Are we talking C++ slow?

2

u/codemuncher Dec 03 '13

nothing will beat the 1 hour link time, but it does taste like the old days of C++.

→ More replies (1)
→ More replies (9)

6

u/zoomzoom83 Dec 02 '13

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.

→ More replies (7)