Its a three way fight this September with Mac stalwart Metrowerks Codewarrior 9 entering the fray with its own Standard C++ Library implementation, MSL C++. Apples August 2003 gcc Updater brings further optimizations for the Power Mac G4 and G5, and a new compiler flag
-fast. And course, macstl returns to defend his crown with version 0.1.4.
macstl is particularly valuable for CodeWarrior developers, since the fast, efficient compiler is hampered by the slow, basic valarray implementation within MSL C++. On the other hand, macstl is 10.0x faster on inline arithmetic, 13.6x faster on inline transcendental and 16.2x faster on inline predication thanks to the killer left-right hook of expression templates and Altivec optimization.
CodeWarrior reigns in compile speed, except when tackling macstls 6 megabyte
altivec_constant.h. However, the compiler seems to have trouble hoisting vector invariants out of loops, punishing its performance on inline scalarization and inline slice vs. gcc.
The August 2003 gcc 3.3 show some minor improvements across the board, due to better instruction scheduling and a touch of loop unrolling. With compiler options set to
-O3 -faltivec -fast -mcpu=G4 , macstl is 3.9x faster on inline arithmetic, 11.7x faster on inline transcendental, 2.7x faster on inline scalarization and 17.3x faster on inline predication.
-fast option seems to introduce reliability problems:
valarray <double>, which is not optimized for Altivec, fails to minimize under the new unit test regime.
Speaking of which, the unit tests are now included with version 0.1.3 onwards. The tests run a battery of operators and functions on valarrays of arbitrary size, and comparing them to C arrays with the same values. Effectively, they compare the results from Altivec algorithms against their scalar equivalents.
I found them very useful in checking the correctness of macstl algorithms as well as vouching for the reliability of new compilers and compiler settings. Go and see for yourself!