209 points · by g0xA52A2A · 4d ago · 44 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]
"As an underapproximation, we currently know of more than 200 issues on GitHub fixed by this change."
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.
If we're citing dictionaries, I'll point out that Wiktionary describes the single-word form as proscribed, i.e. recommended against. [1] And neither the Oxford English Dictionary nor the Cambridge Dictionary even have entries for the single-word form. The Chicago Manual of Style uses it in its two-word form when discussing abbreviations, though it makes no statement about the one-word form as far as I can tell. Same with APA.
So I'll leave it at that. I had no trouble understanding what the author meant. This was purely a nit about style, which is ultimately just bike shedding.
Your own writing and speech already uses thousands of such words with changed spelling (when the incorrect became the norm), changing meaning, etcetera (joke intended), from how they were decades or centuries ago.
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.
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.
I use clang for compiling c++. But I use a custom build system I built on top of it. I compile with -O2 but using -O3 or even -O5 doesn't make much of a difference.
I tried pretty hard to make sure both projects output small binaries and compile fast.
I don't depend on serde because I knew it is bloated but didn't know serde_json was so bloated too.
I am using latest stable rust on linux x86_64 so I assume it is using lld which is what c++ project uses too.
I don't think there are any template use in either project except things like hashmaps and slices etc. I don't use traits except to interact with dependencies in rust.
I use a specific structure in C++ so it is not like regular C++ code but that is just basically impossible to do in rust because I would have to write too much unsafe code and it feels mandatory to use RAII in rust.
-O4 and higher are (currently) equivalent to -O3
> I don't depend on serde because I knew it is bloated but didn't know serde_json was so bloated too.
serde_json depends on serde though?
> I don't think there are any template use in either project except things like hashmaps and slices etc. I don't use traits except to interact with dependencies in rust.
If you're interested in investigating further it might be worth trying cargo bloat [0] or similar to get a bit more data about what is consuming space. rustc's self-profiling framework [1] might be another way to get data.
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
Doing `RUSTFLAGS="-C target-cpu=native" cargo install --path . --locked` on my project.
With lto=`thin` just takes 3.6 seconds on my pc which is very bad if you compare it to the c++ project.
Also the output binary is 1.3MB which is also supremely bad.
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 don't depend on serde, I tried to find an alternative to serde-json but couldn't find anything.
I like crossbeam a lot because it is multi consumer which means I can build a "work stealing" thread pool very easily.
It seems like the majority of the time is taken by the linking.
I like that Rust is principled about correctness, but as a mostly moved on long suffering C++ developer it’s disappointing the replacement suffers from the same poor compilation performance. At least rust has a culture of tracking and working on perf even if philosophically the community puts it low down their list.
0 - https://perf.rust-lang.org/compare.html?start=b5427502dab50c...
This is a great way to describe the “lazy” nature of the new solver.
Are there any benchmarks that include pathological cases of blanket implementations? (It is easy to run into this if you are writing generic numeric code – as I do for a living in bioinformatics)