Re:Reducing Rust Incremental Compilation Times on macOS
by aw1621107 on Sunday April 18, 2021 @10:48AM
(#26852966)
> When does the Rust compiler spend most of it's time? Is it at the checking stage?
rustc has a self-profiler that can be used to answer this question [0], as well as a mode that times compiler passes [1].
There's no single reason the Rust compiler is slow, as it depends quite heavily on the code being compiled. For some codebases, LLVM code takes up most of the time; in other codebases (e.g., extremely generic-heavy codebases), it'll be checking-related passes.
[0]: https://github.com/rust-lang/measureme/blob/master/summarize...
Re:Reducing Rust Incremental Compilation Times on macOS
by optymizer on Sunday April 18, 2021 @10:07AM
(#26852596)
Oh come on now, do you and the parent really have to be those guys who go "well technically they're not zero cost because the programmer has to wait"?
Yes, you're technically correct, but also being unreasonable.
It was pretty clear that "zero cost abstractions" refers to the runtime aspect. That is the default meaning, there's nothing to "get back to".
Re:Reducing Rust Incremental Compilation Times on macOS
by ChrisSD on Sunday April 18, 2021 @11:49AM
(#26853466)
Huh? That was exactly my point.
Re:Reducing Rust Incremental Compilation Times on macOS
by gameswithgo on Sunday April 18, 2021 @01:05PM
(#26854215)
there are some rust programs where the most time is spent in llvm, others hit slow paths in trait bounds analysis, others hit other spots. there is no single hotpath
Re:Reducing Rust Incremental Compilation Times on macOS
by chongli on Sunday April 18, 2021 @11:15AM
(#26853172)
It isn’t even zero runtime cost abstraction though. Monomorphizing all generic functions increases code size. Increased code size causes more instruction cache pressure which may actually slow things down, depending on the application. I could imagine if you’ve got some very large functions that are called on a wide variety of objects then every call could blow out the Icache and kill the hit rate.
Re:Reducing Rust Incremental Compilation Times on macOS
by ben0x539 on Sunday April 18, 2021 @12:51PM
(#26854070)
It's an abstraction over writing out the monomorphized version by hand. Zero-cost doesn't mean using the abstraction gets you the fastest possible implementation of whatever you're doing.
Incidentally your first question is one that's very amenable to testing. When does the Rust compiler spend most of it's time? Is it at the checking stage?