Kernighan shared his thoughts on what he thinks of the world today — with its push away from C to more memory-safe programming languages, its hundreds of distributions of Linux — and with descendants of Unix powering nearly every cellphone.
And the compiler was slow, the code that came out was slow…
The compiler is slower because it has more to check for, but “the code that came out was slow” seems like nonsense, exaggeration, or PEBCAK. Rust code is highly performant and very close to C code.
The support mechanism that went with it — this notion of crates and barrels and things like that — was just incomprehensibly big and slow.
Dude what? C’s build systems like cmake are notoriously unfriendly to users. Crates make building trivial compared to the ridiculous hoops needed for C.
I have written only one Rust program, so you should take all of this with a giant grain of salt,” he said. “And I found it a — pain… I just couldn’t grok the mechanisms that were required to do memory safety, in a program where memory wasn’t even an issue!
He doesn’t say what the program was, and the borrow checker operates by a set of just a few extremely simple rules. There’s no idea of what he was trying to accomplish or how the borrow checker impeded that.
So my reaction as someone who cares deeply about how disastrously unsafe C is and the tangible havoc it creates in modern society:
I agree the compiler is slower. Honestly boo hoo. It’s slower for two very good reasons (better static analysis and better feedback).
The code being slower is such a minor issue as to effectively not be true. Benchmarks prove this.
I’m not going to take “big and slow” as a serious critique of Cargo from someone who idealizes C’s ridiculous, tedious, convoluted build system.
The borrow checker is trivial, and unlike C, the compiler actually gives you easy, intuitive feedback for why your code doesn’t build.
In my limited experience the speed a rust complied executable runs is highly dependent on compiler options. By default (from what I remember), rust includes a ton of debug info in the resulting program. With the correct compiler flags you can strip all that out and programs run very close to c speeds.
Yeah, cargo build produces a debug build and cargo build --release is for actually distributing to users. (It doesn’t add the debug symbols, but also spends more time optimizing.)
The support mechanism that went with it — this notion of crates and barrels and things like that — was just incomprehensibly big and slow.
Dude what? C’s build systems like cmake are notoriously unfriendly to users. Crates make building trivial compared to the ridiculous hoops needed for C.
I wouldn’t be surprised, if the guy does not normally use a build system to begin with. Professors don’t tend to have the time to write software that would require a build system (both in terms of complexity and being used by end users).
So, I’m guessing, all he wanted was rustc, but most Rust tutorials don’t bother explaining it, because cargo isn’t much harder to use.
It’s slower for two very good reasons (better static analysis and better feedback).
Apparently that’s not really the reason. cargo check is usually quite fast.
I also wouldn’t say Rust code is slower than C. It wins in some places (e.g. strict aliasing) and loses in others (e.g. bounds checks) but in practice it’s usually much faster because it’s so much easier to use fast containers (not just linked lists everywhere), fast libraries, and multithreading.
I don’t know how else they could react:
The compiler is slower because it has more to check for, but “the code that came out was slow” seems like nonsense, exaggeration, or PEBCAK. Rust code is highly performant and very close to C code.
Dude what? C’s build systems like cmake are notoriously unfriendly to users. Crates make building trivial compared to the ridiculous hoops needed for C.
He doesn’t say what the program was, and the borrow checker operates by a set of just a few extremely simple rules. There’s no idea of what he was trying to accomplish or how the borrow checker impeded that.
So my reaction as someone who cares deeply about how disastrously unsafe C is and the tangible havoc it creates in modern society:
In my limited experience the speed a rust complied executable runs is highly dependent on compiler options. By default (from what I remember), rust includes a ton of debug info in the resulting program. With the correct compiler flags you can strip all that out and programs run very close to c speeds.
Yeah,
cargo build
produces a debug build andcargo build --release
is for actually distributing to users. (It doesn’t add the debug symbols, but also spends more time optimizing.)I wouldn’t be surprised, if the guy does not normally use a build system to begin with. Professors don’t tend to have the time to write software that would require a build system (both in terms of complexity and being used by end users).
So, I’m guessing, all he wanted was
rustc
, but most Rust tutorials don’t bother explaining it, becausecargo
isn’t much harder to use.Apparently that’s not really the reason.
cargo check
is usually quite fast.I also wouldn’t say Rust code is slower than C. It wins in some places (e.g. strict aliasing) and loses in others (e.g. bounds checks) but in practice it’s usually much faster because it’s so much easier to use fast containers (not just linked lists everywhere), fast libraries, and multithreading.
No language guarantees high-speed code. Rust, like C and C++, is also perfectly suited for writing slow code