News for hackers. Stuff that matters.
Re:"Why is the Rust compiler so slow?" by windward on Friday June 27, 2025 @04:23AM (#44394891)
>Codegen is also a problem. Rust tends to generate a lot more code than C or C++

Wouldn't you say a lot of that comes from the macros and (by way of monomorphisation) the type system?

Re:"Why is the Rust compiler so slow?" by jandrewrogers on Friday June 27, 2025 @11:48AM (#44397739)
Modern C++ in particular does a lot of similar, albeit not identical, codegen due to its extensive metaprogramming facilities. (C is, of course, dead simple.) I've never looked into it too much but anecdotally Rust does seem to generate significantly more code than C++ in cases where I would intuitively expect the codegen to be similar. For whatever reason, the "in theory" doesn't translate to "in practice" reliably.

I suspect this leaks into both compile-time and run-time costs.