4 ms·
Apart from rare pathological cases borrow checking is not a significant part of compilation time. Disabling it would be very detrimental for little gain.
by Thiez 4y ago
Apart from rare pathological cases borrow checking is not a significant part of compilation time. Disabling it would be very detrimental for little gain.
- sowbug 4y agoAs an end user of Rust, I think the borrow checker seems slow because it's one of the last phases to run during vscode's real-time feedback. More than once I've been in the midst of a long refactoring session, and finally fix what I think is the very last syntax problem. But then the borrow checker finally gets to run, and then I learn about a whole new set of problems.
- loeg 4y agoApologies, I was under the impression it was a significant cost. Do you have any good analysis of where Rust compiler time goes you could link to?
- Thiez 4y agoHere is a nice article that goes into detail: https://fasterthanli.me/articles/why-is-my-rust-build-so-slow https://fasterthanli.me/articles/why-is-my-rust-build-so-slo... Here is an older article that compares compilation times between multiple different libraries, where one of them does spend a significant (and majority of the) time borrow checking: https://wiki.alopex.li/WhereRustcSpendsItsTime https://wiki.alopex.li/WhereRustcSpendsItsTime
- jynelson 4y agohttps://www.pingcap.com/blog/rust-compilation-model-calamity/ https://www.pingcap.com/blog/rust-compilation-model-calamity... is a good overview. In general it varies depending on the crate but we track the performance at https://perf.rust-lang.org/ https://perf.rust-lang.org/ - if you look at cargo, for example, over 60% of the time is spent in codegen through LLVM: https://perf.rust-lang.org/detailed-query.html?commit=222d1ff68d5bfe1dc2d7f3f0c42811fe12964af9&base_commit=606c3907251397a42e23d3e60de31be9d32525d5&benchmark=cargo-0.60.0-debug&scenario=full https://perf.rust-lang.org/detailed-query.html?commit=222d1f...