2 ms·
Do you know what's causing that? 1. Maybe monomorphisation overduplicates code, so that different invocations produce the same machine code in the end? 2. If
by jules 8y ago
Do you know what's causing that?
1. Maybe monomorphisation overduplicates code, so that different invocations produce the same machine code in the end?
2. If that's not happening, maybe idiomatic Rust code causes a lot of code to be generated where a C programmer would have written something differently, e.g. using a void* instead of passing by value?
3. If that's not happening either, maybe monomorphisation is more or less producing what a C programmer would have monomorphised manually, but it takes the compiler a long time to optimise away abstractions?
It seems that in this C++ example the problem is #3: it takes a long time to optimise away the range & lambda abstraction.
- steveklabnik 8y agoIt’s all three.