by melling · 12y ago · 0 comments
That said, we're working on compilation speed. The focus so far has been getting the language in shape and runtime performance of the generated code, not compilation speed (although we've picked most of the low-hanging fruit in compilation speed anyway).
I'm not really a fan of Go but waiting for the compiler can be a pretty significant productivity killer on larger projects. Their fast compilation times are a pretty big selling point for what is (IMO) an otherwise underwhelming language design.
The vast majority of compile time for optimized builds (80%-90%) is spent in code generation and optimization in LLVM.
For unoptimized builds, most of the compile time is spent in the typechecker doing type unifications for method lookup. With some optimizations to quickly reject method candidates I suspect this can be greatly improved.
Incremental compilation for the fast turnaround is being worked on and there has been significant progress, to address comex' complaint.
> Their fast compilation times are a pretty big selling point for what is (IMO) an otherwise underwhelming language design.
Go 6g/8g also doesn't do much optimization by comparison to GCC/LLVM. (Rust uses LLVM.)
You should compare with gccgo, though.
Generally I think many people complain too much for what takes a few seconds.
C++ builds are measured in hours, usually require distributed build systems, clever use of forward declarations and cutting class private declarations into static code or PImpl classes to bring it down to something manageable.
No, but it is was better than what C and C++ have.
> Nor did they do much optimization.
I don't use them since the late 90's, but they used to be comparable to contemporary C and C++ MS-DOS/Windows compilers.
There has been an enormous difference in the quality of optimization and code generation since the 1990s, when single-pass compilers such as Turbo Pascal and Delphi were common. At that time you usually went straight from AST to machine code, doing some peephole optimizations along the way, but this is unacceptable today if you want to compete with modern C and C++ compilers (or even Java HotSpot). The introduction of SSA (and along with it GVN, SROA, SCCP, etc.) was a big deal.
What I was trying to say, it that if you put a C or C++ compiler against Turbo Pascal or Delphi compiler of the same age, the latter will compile way faster and generate similar code in terms of quality.
If they had received the same investment as C and C++ had become since those days, the situation would still hold.
But history took another path, so it is kind of moot point now.
Also, the language was quite simple. With large, complex programs, the most time-consuming stage was in the linking of the final binary.
If you want a similarly fast compiler today, look at Go.
There's also the amazing and much underrated Free Pascal: http://www.freepascal.org
First and foremost, a language must satisfy some need that is not met adequately by another existing language. Otherwise it's useless.
There are languages already with fast compilers, and some of them are pretty fast and have pretty good semantics.
Rust is really trying to offer a combination of things not available elsewhere: safety, speed, and control. But that innovation is based heavily on compiler features, which have a compile-time performance penalty.
Assuming rust succeeds on delivering an innovative new language, they can secondarily try to improve compiler performance. Or find ways to avoid paying some compile-time costs in certain situations.