3 ms·
trigger warning: possible rust advocacy. I hope the warning can help some folks relax, and stave off the usual repeating meta discussion. I've looked at a lot
by raggi 4y ago
trigger warning: possible rust advocacy.
I hope the warning can help some folks relax, and stave off the usual repeating meta discussion.
I've looked at a lot of rust generated outputs from iterator usage in godbolt. If you have tried this (and if not, go look), you'll know that you almost certainly never want to look at debug output for iterator usage.
In release mode builds of rust programs using the iterator package you'll often see SIMD. The author doesn't need to do special things to get this, the combination of aggressive inlining and encouragement to use owned and intrusive structures goes a long way to making this viable more often in practical code - so much so that I see it working _a lot_. It's not a magic bullet, and I'm not advocating that it's some be-all end-all, but it works well there.
If you'd like to see an example, search for "godbolt rust iterator" and look at the optimized output. I'm sure one of the near top results will do.
- fulafel 4y agoI think the interesting question is that how big a speed delta does a typical Rust app enjoy when built with autovectorization enabled vs not. You get points for going faster, not for sometimes emitting the instructions.
- joshfee 4y agoRust or otherwise, the more semantics that can be expressed in a language, the more optimizations that can be done for you (at the cost of lacking full control in certain scenarios).
- nitwit005 4y agoA lot of people in C++ land probably just have the vector optimizations off. If you use clang, you will get vector instructions at -O2. Gcc seems to need -O3, or the specific flags enabled.