For Complex Applications, Rust Is as Productive as Kotlin
ferrous-systems.com
ferrous-systems.com
Ever since I started using a language server on my Emacs (plus `rust-analyzer`) my flow has improved because I can almost immediately see compiler errors or warnings but `cargo run` and `cargo build` are still slower than they should be. Seems like no matter how strong your machine is, those final steps can never go below 6-7s. (I have a fairly modern Xeon workstation)
Those 7s of delay sound funny for many and I've been made fun of for mentioning it but I'll stand behind my statement: when you're in the productive speedy flow state, you need instant feedback. If you don't have it, you lose your motivation to iterate rapidly.
Even though I believe Rust to be the future of low-level and mega-fast computing, it still has nothing on the Go and OCaml compilers/linkers, sadly. Even Elixir -- a dynamic but compiled language -- feels near-instant when you use LSP.
C++ version, with binary dependencies, a couple of minutes, not longer than 5.
Rust version, as if has to compile the whole world, 16 minutes currently.
My measurement is against .NET Native, D, Delphi on similar hardware.
On positive note, Cranelift just got merged, that will certainly improve compile times.
I expect to be fairly big project.
https://github.com/pjmlp/gwc-rs
About 80% of the time is spent compiling Gtk-rs, which I avoid in C++ thanks to OS package manager and pkg-config.
Also note that the original C++ Gtkmm version was already quite fast to compile in 2002 hardware, when I submitted the article to "The C/C++ Users Journal".
When cargo finally handles binary libraries, instead of stuff like scache, I expect a similar experience to C++ with binary libraries and modules.
Unfortunately it suffers from a small community, so it is only appealing to devs that enjoy getting their hands dirty to implement missing libraries, or contribute to the existing compilers/libraries.
Granted, first-time compilation takes a while, but once that's taken care of, I don't update my toolchain often enough for it to have a noticeable impact on my workflow. I guess if you're getting a new nightly build every day and re-compiling everything, that might be a pain, but that doesn't seem to be the root of most people's complaints.
As mentioned in my comment above, for most people waiting a few seconds is a funny non-issue but it directly affects my motivation to rapidly iterate.
The "take a sip" brain hack might work, I'll try it. :) But I try to follow rules for proper hydration which means that you shouldn't sip water every other minute -- there have to be pauses.
It's a good advice regardless. I'll see if I can adopt a variation of it.
Plus, I am talking about a company-issued laptop. It's quite the fast and strong cute little thing but we all know even the strongest mobile CPUs can't measure up to desktop CPUs, especially when it comes to compilation.
As a result, a lot of the iteration that happens is between me and `rust-analyzer` and `cargo check`, which, as you note, is much faster than a compilation pass with codegen and link.
Which is why I would avoid rust for anything where productivity is crucial.
Surely we can be more nuanced than this? Compile times vary greatly between different projects and dependencies.
On the other hand if you just need compiler errors, cargo check runs almost instantly for incremental checks.