Live data from Hacker News

Rust compiler performance

kobzol.github.io

31–40 of 264 posts

Re: Rust compiler performance

#31
post #27

Compiler performance must be considered up front in language design. It is nearly impossible to fix once the language reaches a certain size without it being a priority. I recently saw here the observation that one can often get a 2x performance improvement through optimization, but 10x requires redesigning the architecture. Rust can likely never be rearchitected without causing a disastrous schism in the community,…

[flagged]

Re: Rust compiler performance

#32
post #30

Maybe these features already exist, but I'd like a way to: 1) Type check without necessarily building the whole thing. 2) Run a unit test, only building the dependencies of that test. Do these exist or are they remotely feasible?

You don't even need to ask AI to get an answer to the first question, the first hit on both Google and Bing will tell you how to do it - it takes 2 seconds!

Re: Rust compiler performance

#33
post #30

Maybe these features already exist, but I'd like a way to: 1) Type check without necessarily building the whole thing. 2) Run a unit test, only building the dependencies of that test. Do these exist or are they remotely feasible?

cargo check exists for option 1. For 2.) it depends on the project structure. Either way, they don't help as much as you would hope for.

Re: Rust compiler performance

#34

I wonder if how much value there is in skipping LLVM in favor of having a JIT optimized linked in instead. For release builds it would get you a reasonable proxy if it optimized decently while still retaining better debugability. I wonder if the JVM as an initial target might be interesting given how mature and robust their JIT is.

I would love this in modern languages.

For dev builds, I see JIT compilation as a better deal than debug builds because it's capable of eventually reaching peak performance. For performance sensitive stuff like games, it really matters to keep a nice feedback loop without making the game unusable by turning off all optimizations.

AOT static binaries are valuable for deployments.

No idea how expensive it would be to develop for an existing language like Rust though.

Re: Rust compiler performance

#35

Having worked on large scale C++ code-bases and thus used to long compilation times, it surprises me that this is the hill many C++ devs would die on in regards to their dislike of Rust.

Makes sense to me! Everyone with enough C++ experience has dealt with that nightmare at one point. Never again, if you can help it.

Re: Rust compiler performance

#37
post #27

Compiler performance must be considered up front in language design. It is nearly impossible to fix once the language reaches a certain size without it being a priority. I recently saw here the observation that one can often get a 2x performance improvement through optimization, but 10x requires redesigning the architecture. Rust can likely never be rearchitected without causing a disastrous schism in the community,…

[flagged]

The original comment is mostly inline with the article.

All the easy local optimizations have been done. Even mostly straightforward compiler wide changes take a team of people multiple years to land.

Re-architecting the rust compiler to be faster is probably not going to happen.

Re: Rust compiler performance

#38
A true champion

> when I started contributing to Rust back in 2021, my primary interest was compiler performance. So I started doing some optimization work. Then I noticed that the compiler benchmark suite could use some maintenance, so I started working on that. Then I noticed that we don’t compile the compiler itself with as many optimizations as we could, so I started working on adding support for LTO/PGO/BOLT, which further led to improving our CI infrastructure. Then I noticed that we wait quite a long time for our CI workflows, and started optimizing them. Then I started running the Rust Annual Survey, then our GSoC program, then improving our bots, then…

Re: Rust compiler performance

#39

Having worked on large scale C++ code-bases and thus used to long compilation times, it surprises me that this is the hill many C++ devs would die on in regards to their dislike of Rust.

There's a lot of things you can do in C++ to reduce compilation time if you care about it, that aren't possible with Rust.

There are things you can do for Rust if it really is a deal breaker.

Dioxus has a hot reload system. Some rust game engines have done similar things.

Re: Rust compiler performance

#40
Not related to the article, but after years of using Rust, it still is a pain in the ass. While it may be a good choice for OS development, high frequency trading, medical devices, vehicle firmware, finance software, or working on device drivers, it feels way overkill for most other general domains. On the other hand, I learned Zig and Go both over a weekend and find they run almost as fast and don't suffer from memory issues (as much as say Java or C++).
Post reply on HN