4 ms·
Is it me, or does the Rust compiler produce terribly unoptimized code? Just compare it to the equivalent C++ code: https://godbolt.org/g/Jdfkm6 https://godbolt
by alexeiz 8y ago
Is it me, or does the Rust compiler produce terribly unoptimized code? Just compare it to the equivalent C++ code: https://godbolt.org/g/Jdfkm6 https://godbolt.org/g/Jdfkm6. Both Clang and GCC produce really lean binary output.
- steveklabnik 8y agoSometimes. It just depends. Some possibilities: 1. The parent didn’t say if they compiled with optimizations. I bet they did, as the code would probably look even worse without, but who knows. 2. This isn’t apples to oranges, as you’re not doing formatting here, right? 3. The formatting code makes various trade offs; it’s not optimized for speed, more for size, in my understanding. 4. Codegen bugs do happen. Maybe this is a degenerate case. In general, if the code is significantly worse, then it’s a bug.