STL versus Naked Pointers
I initially ran the benchmarks for this article using STL vectors to store data, but was curious how the STL performance compared to using naked pointers. Listing Five (available online) uses the restrict keyword with pointers in place of STL vectors.
In Figures 5, 6, and 7, I plot the ratio of the Pointer time to the STL time for the Triangle, Quadrilateral, and Brick benchmarks, respectively (a value less than 1 means the naked pointers are faster). The Quadrilateral benchmark results show that the pathscale 3.0 compiler on the Opteron ran 32 percent faster on average when using restricted pointers instead of the STL. On the other hand, the g++ compiler ran slightly faster on every benchmark configuration when using the STL. I had to omit the XlC compiler from this comparison because of overly aggressive optimizations that occurred when using pointers.