FREE Subscription to Dr. Dobb’s Digest: Same Great Content, New Digital Edition
Site Archive (Complete)
Development Tools
Email
Print
Reprint

add to:
Del.icio.us
Digg
Google
Furl
Slashdot
Y! MyWeb
Blink
TABLE OF CONTENTS
May 07, 2008

Performance Portable C++

(Page 3 of 5)

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.

Figure 5: Point class/Triangle class.

Figure 6: Point class/Quadrilateral class.

Figure 7: Point class/Brick class.

Previous Page | 1 Performance Portable C++ | 2 The Benchmarks | 3 STL versus Naked Pointers | 4 Class Partitioning | 5 Conclusion Next Page
TOP 5 ARTICLES
No Top Articles.



MICROSITES
FEATURED TOPIC

ADDITIONAL TOPICS

INFO-LINK