Top
Best
New

Posted by Bogdanp 5 days ago

Why is the Rust compiler so slow?(sharnoff.io)
300 points | 426 commentspage 3
aappleby 5 days ago|
you had a functional and minimal deployment process (compile copy restart) and now you have...
canyp 5 days ago|
...Kubernetes.

Damn, this makes such a great ad.

cratermoon 5 days ago||
Some code that can make Rust compilation pathologically slow is complex const expressions. Because the compiler can evaluate a subset of expressions at compile time[1], a complex expression can take an unbounded amount of time to evaluate. The long-running-const-eval will by default abort the compilation if the evaluation takes too long.

1 https://doc.rust-lang.org/reference/const_eval.html

TZubiri 5 days ago||
>Every time I wanted to make a change, I would:

>Build a new statically linked binary (with --target=x86_64-unknown-linux-musl) >Copy it to my server >Restart the website

Isn't it a basic C compiler feature that you can compile a file as an Object, and then link the objects into a single executable? Then you only recompile the file you changed.

Not sure what I'm missing.

pornel 5 days ago|
That's how Rust works already.

The problem has been created by Docker which destroys all of the state. If this was C, you'd also end up losing all of the object files and rebuilding them every time.

TZubiri 4 days ago||
Nope, reread the article, docker wasn't part of the problem it's part of the 'solution' according to OP.
kelnos 5 days ago||
> This is... not ideal.

What? That's absolutely ideal! It's incredibly simple. I wish deployment processes were always that simple! Docker is not going to make your deployment process simpler than that.

I did enjoy the deep dive into figuring out what was taking a long time when compiling.

quectophoton 5 days ago|
One thing I like about Alpine Linux is how easy and dumbproof it is to make packages. It's not some wild beast like trying to create `.deb` files.

If anyone out there is already fully committed to using only Alpine Linux, I'd recommend trying creating native packages at least once.

eddd-ddde 5 days ago||
I'm not familiar with .deb packages, but one thing I love about Arch Linux is PKGBUILD and makepkg. It is ridiculously easy to make a package.
tmtvl 5 days ago||
Just set up a build server and have your docker containers fetch prebuilt binaries from that?
mellosouls 5 days ago||
Related from a couple of weeks ago:

https://news.ycombinator.com/item?id=44234080

(Rust compiler performance; 287 points, 261 comments)

OtomotO 5 days ago||
It's not. It's just doing way more work than many other compilers, due to a sane type system.

Personally I don't care anymore, since I do hotpatching:

https://lib.rs/crates/subsecond

Zig is faster, but then again, Zig isn't memory save, so personally I don't care. It's an impressive language, I love the syntax, the simplicity. But I don't trust myself to keep all the memory relevant invariants in my head anymore as I used to do many years ago. So Zig isn't for me. Simply not the target audience.

ic_fly2 5 days ago||
This is such a weird cannon on sparrows approach.

The local builds are fast, why would you rebuild docker for small changes?

Also why is a personal page so much rust and so many dependencies. For a larger project with more complex stuff you’d have a test suite that takes time too. Run both in parallel in your CI and call it a day.

gz09 5 days ago|
Unfortunately, removing debug symbols in most cases isn't a good/useful option
magackame 5 days ago|
What "most" cases are you thinking of? Also don't forget that a binary that in release weights 10 MB, when compiled with debug symbols can weight 300 MB, which is way less practical to distribute.
More comments...