24 comments
Apparently it's easier to work with and more correct. Future type system changes are blocked on it. These 2 in particular were called out as being blocked by the new trait solver [1]
It is a latin phrase that literally translates to "and the rest." "Et" means "and," and "cetera" means "the rest."
This is a great article! Apologies for being pedantic. I'm just noting this fun fact here in case the author is checking this thread.
It's very commonly written as one word in English. Just do a web search for "etcetera" to find many examples.
Of course any theorem prover will have an even deeper connection to logic in it's compiler and we've been building those since the 70s.
Which other compilers do you know?
Swift compilers when doing the same?
Haskell compilers when doing the same?
Idris, F*, Dafny, Koka,..... compilers doing the same?
I have a 4k line project that depends on serde-json, xxhash, crossbeam and rand.
It takes several seconds to compile in release mode.
This is insane compared to my 20k line project in C++ which compiles everything and runs all tests in 0.7 seconds.
The C++ project doesn't depend on libc or any external libraries but that is not a practical option in rust.
I tried bunch of different options and actually removed some dependencies but it seems like it is not possible to get the rust program to compile fast.
Does anyone know why it is this slow comparatively?
Also the point of the release profile is to trade compilation performance for runtime performance (you'd be better off iterating on the dev profile).
There are also many other details that interfere and can't be inferred from your comment like: what's your OS, which linker are you using, are you using opt-level 3 on C++, which compiler are you using on C++, are you using heavily using templates in C++ or macros in Rust, etc.
Aside from the std library (which you're not paying for in compile time because it's precompiled). Why is this different in Rust vs. C++? Sure, it's inconvenient not to use e.g. serde, but it's equally inconvenient in C++...
Taffy (https://github.com/DioxusLabs/taffy) which is ~26k LoC + a handful of dependencies compiles in release mode in ~1.6s
you might also be able to drop crossbeam for stdlib types and rand for much smaller random library if you don't need it's comprehensive features.
cargo's release profile also uses opt level 3 and thin-local lto by default. Whether you need those is up to you, hard to say more without knowing your project!
but yes it is somewhat easy to allow rust projects to creep up in compile times especially with how easy it is to bring in big useful libraries that often come with a lot of features. disabling features where possible is the go to if you have big dependencies.
I think there is a little error in the code snippets near the caching section start where it claims variables are swapped but they are not? Though maybe I have just misunderstood something.
Read the full thread on Hacker News →
Related stories
- Enabling the next-generation trait solver on nightlyblog.rust-lang.orgHacker News · 2 points · 2 months ago
- Hacker News · 1 points · about 2 months ago
- Primal Solvergithub.comHacker News · 1 points · 2 months ago
- Optimizing x264 settings and per-title laddersstreaminglearningcenter.comHacker News · 23 points · 2 months ago
- Open-Sourcing Rebalancer: High-Performance Assignment Problem Solverengineering.fb.comHacker News · 1 points · 2 months ago
- ServingStudio: Simulating, Analyzing, and Optimizing LLM Serving Systemssyfi-servingstudio.github.ioHacker News · 3 points · 2 months ago