News for hackers. Stuff that matters.
Re:Language Design: Use 'ident: Type' not 'Type ident' by Gibbon1 on Friday May 01, 2020 @07:17PM (#23047494)
C++ is stuck in this trap where because it's slow to compile, the compiler maintainers increase the amount of optimizations the compiler does to make it faster. Which of course makes the compiler even slower. Which motivates them to increase the amount of optimizations. Which makes the compiler yet slower.

I feel part of the problem with rust is it doesn't have quick and dirty mode thats fast and a production ready mode that is slow but does all the checks. I do this with my C programs, using various formal analysis tools which are slow to vet the code before releasing it.

Re:Language Design: Use 'ident: Type' not 'Type ident' by TsiCClawOfLight on Saturday May 02, 2020 @04:14AM (#23050253)
Checks in rust are fast. In fact, you can 'cargo check' to run checks without actually compiling, and that will finish in less than half a second.

Most editors did this on save before LSP came along. For logic, this is fast enough because the type system catches enough mistakes and I don't need to run tests all the time. For UI though, a faster iteration cycle would be nice...

Re:Language Design: Use 'ident: Type' not 'Type ident' by MauranKilom on Friday May 01, 2020 @10:47PM (#23048693)
C++ debug builds (i.e. without optimizations) are not that much faster in my experience. So it's not optimizations that are the culprit.
Re:Language Design: Use 'ident: Type' not 'Type ident' by steveklabnik on Friday May 01, 2020 @08:24PM (#23047880)
The checks are not the most expensive part of compiling Rust.
Re:Language Design: Use 'ident: Type' not 'Type ident' by Gibbon1 on Friday May 01, 2020 @09:25PM (#23048253)
What is it then?
Re:Language Design: Use 'ident: Type' not 'Type ident' by Ar-Curunir on Friday May 01, 2020 @10:49PM (#23048704)
The codegen is. This is partially because the IR passed to LLVM is not the best, but it’s also not terrible.
Re:Language Design: Use 'ident: Type' not 'Type ident' by MaxBarraclough on Saturday May 02, 2020 @06:20AM (#23050788)
Does Rust allow for fast unoptimised builds then? Perhaps I'd missed that.
Re:Language Design: Use 'ident: Type' not 'Type ident' by steveklabnik on Saturday May 02, 2020 @08:01AM (#23051243)
Faster, yes. Still lots to do.
Re:Language Design: Use 'ident: Type' not 'Type ident' by MaxBarraclough on Saturday May 02, 2020 @08:12AM (#23051280)
You're saying LLVM is slow even when generating code without optimisations?
Re:Language Design: Use 'ident: Type' not 'Type ident' by steveklabnik on Saturday May 02, 2020 @08:37AM (#23051392)
Yes.

The thing that will massively speed up rustc is the current re-architecting of it. We’re at the point of “few percent here, few percent there” with the current design. These add up over time, of course, but batch compilers are inherently slower than the newer style ones (after an initial compile).

Re:Language Design: Use 'ident: Type' not 'Type ident' by Ar-Curunir on Sunday May 03, 2020 @07:31PM (#23062768)
To add to Steve’s point, Rust adds more checks during debug (non-release) more, which can makes the IR larger. So it’s not always the case that debug mode is faster to compile (though it generally is)