|Rust||Stopped after 30 minutes|
|Swift||Stopped after 30 minutes|
|D||Segfault after 6 minutes|
I wrote a small program that generates 400 000 lines of code in several languages to benchmark their compilation speed.
All compilers (except Go) don't do optimization in this benchmark.
update Turns out generating one function with 400k lines of code is a bad idea :) Go and D segfault, Java simply refuses to compile. I'll modify the test soon.
You can read the code of the generator here.
It's a bit silly, all it does is generate the following pair of statements 200 000 times:
a = 1 println(a) a = 2 println(a) ...
I'm aware that in no way does this represent real code, but it can give a general picture, and all compilers face the same challenge.
Rust and Swift took too long to compile 400k lines, so I tried smaller numbers: