4 ms·
I think it’s acceptable for Rust compilation to end up slower than C++. After all, the compiler does a lot more work for you with the borrow checker and all. Th
by pharmakom 4y ago
I think it’s acceptable for Rust compilation to end up slower than C++. After all, the compiler does a lot more work for you with the borrow checker and all. That doesn’t mean we shouldn’t strive to make it better though.
- strager 4y agoI'd wager that the C++ compiler does more work churning through #include-s than the Rust compiler does tracking borrows.
- bluGill 4y agoC++20 modules is supposed to fix that. I wish I could get compilers that implemented them.
- pjmlp 4y agoThere you go, https://visualstudio.microsoft.com/vs/community/ https://visualstudio.microsoft.com/vs/community/ One example to get you started, https://github.com/pjmlp/RaytracingWeekend-CPP https://github.com/pjmlp/RaytracingWeekend-CPP
- Narishma 4y agoWhat makes you think it is slower because of the borrow checker?
- antonvs 4y agoIt’s not because of the borrow checker specifically, but the type system design that makes the borrow checker possible is a big part of what leads to slower compilation times. On the other hand, that extra time is traded off against not having to deal with bugs at runtime that the type system is able to catch. Rust is one of the better languages when it comes to making illegal states unrepresentable.
- vegerot 4y agoI know the article is really detailed, and I don’t remember a lot of it either! But he does specifically break down how much of compilation time is spent in the borrow checker, LLVM, macro expansion, etc.
- dgb23 4y agocargo check seems to be quite fast in comparison to compilation?