https://github.com/cdunn2001/compile-times/blob/master/results/MacAir2015-10k.csv
That is copied from a reddit thread nearly 2 years ago, and I've added Nim. It's not a great test -- only function calls, assignments, and bit-level operations in a single file -- but it's a data-point. (Rust is very slow, so I suppressed it.)
I noticed that the nim-generated C-code compiles very quickly; nim itself is the main cost. I was wondering if anyone knows what sorts of things would compile much faster in Nim than in C++.
Please add the following option to the compiler invocation:
--cc:tcc
It should shave a few seconds off of Nim's result.
nim itself is the main cost
Unless I'm misremembering, Araq said that the compiler doesn't implement incremental compilation yet, so there's that.
I was wondering if anyone knows what sorts of things would compile much faster in Nim than in C++
Well, anything really. The problem with C++ is that its syntax is so ambiguous that any bit of code could possibly be anything and do anything. Also, the consensus seems to be that using C++ templates slows the compiler down to a crawl. In comparison, I never had much of a problem with Nim macros. Also, there is no TCC equivalent for C++ that I know of, so there's that.
Have a look at what Walter Bright has to say about C++ compilation speed.
The biggest problem that C++ faces in general is that it depends on #include files, which in the worst case can make compilation times quadratic as a function of source code size. Nim uses #include files only sparingly (primarily "nimbase.h" and <string.h>, plus whatever is needed by extern procedures). Each Nim source file, of course, is processed only once.
The biggest issue with compiling large code bases right now is the lack of incremental compilation; while the C compilation stage is already incremental, the Nim compiler still has to process the entire source code each time. See this GitHub issue for Araq's plans for incremental compilation in Nim.