Anux
Rust is similar to C++, maybe worse, in terms of code bloat due to monomorphisation of all the generics. Wouldn't be surprised if that causes too much code with O3, filling up caches making it slower overall. I can see this tradeoff working out differently with plain C. But yes, in general you are correct that it depends on the specific CPU and there's a threshold after which optimizations that increase code size hurt performance. I also suspect this might somewhat depend on system load, meaning a large number of concurrent processes would benefit from smaller code vs. a single process hogging the CPU, but I have seen no testing on this yet.
Rust is similar to C++, maybe worse, in terms of code bloat due to monomorphisation of all the generics. Wouldn't be surprised if that causes too much code with O3, filling up caches making it slower overall. I can see this tradeoff working out differently with plain C. But yes, in general you are correct that it depends on the specific CPU and there's a threshold after which optimizations that increase code size hurt performance. I also suspect this might somewhat depend on system load, meaning a large number of concurrent processes would benefit from smaller code vs. a single process hogging the CPU, but I have seen no testing on this yet.
Comment