3 ms·
> Also, zero-cost abstraction is likely the biggest bullshit I've ever heard, there is a lot of cost and there's also a lot of waiting for compiler if you're us
by fao_ 7y ago
> Also, zero-cost abstraction is likely the biggest bullshit I've ever heard, there is a lot of cost and there's also a lot of waiting for compiler if you're using cargo packages.
While someone else is right that "zero-cost" refers to runtime cost rather than compilation cost, dependencies are the biggest problem.
The program `spotifyd` takes over an hour to compile on my X200 laptop. This is, for reference, the same amount of time that the Linux Kernel and GCC takes to compile (Actually, I think GCC takes less time...). Most of the compilation time is on the 300+ dependencies, that simply wrap C (and in some places, replicate) libraries that I already have installed on my system!
- stefan_ 7y agoAn X200 is also an ancient machine. Do you value your own time so little? Clearly you are annoyed by the compile times? You can get a $200 CPU that will blast through a kernel compile in 3 minutes.
- fao_ 7y ago> An X200 is also an ancient machine. Do you value your own time so little? Clearly you are annoyed by the compile times? I value my security first and foremost. My X200 has zero binary blobs running on the machine, it also has several other properties that I appreciate. > You can get a $200 CPU that will blast through a kernel compile in 3 minutes. That assumes that I even have the money to afford that. Not all of us live in silicon valley.
- deleted 7y ago[deleted]
- hathawsh 7y agoI've also heard that Rust compilation is slow, so I put off learning it for a while. I finally dug in deep recently and, to be honest, I don't understand the issue. Rust compilation is quite fast in my experience. Your comment was the first I've heard of spotifyd, so I downloaded it from github and ran "cargo build". I spent 3 minutes figuring out that I needed to install the "libasound2-dev" package, then I spent less than 2 minutes compiling. I watched the clock to be sure, but after only 2 minutes, Cargo produced a target/debug/spotifyd executable. Maybe you're referring to --release compilation? I don't have the fastest PC, it's just an 8 year old desktop with a 6 core Intel i7 980x running Ubuntu 18.04. Rust compilation maxes out all the cores, which is really nice. With the RustEnhanced package added to Sublime Text, editing Rust code is a very interactive experience with practically instant feedback. Running tests is fast too. I wish I understood why some people are apparently having a very different experience. Maybe it's slow on some operating systems.
- fao_ 7y ago> Maybe you're referring to --release compilation? Indeed.
- hathawsh 7y agoOk, well, "cargo build --release" took 3 minutes and 55 seconds, which I would consider reasonably fast for compiling and optimizing 300+ libraries. I guess your laptop has only 2 cores in an older processor, which would explain the difference. Kudos to you for keeping good hardware alive.
- cztomsik 7y agosometimes it takes 100x more without any apparent reason - it's probably because of memory or something, what takes minute to compile on my MBA, sometimes never finishes on raspi3 (swap is off) I currently compile on raspi4 and scp the results there to check.