Boost logo

Boost :

From: Scott McMurray (me22.ca+boost_at_[hidden])
Date: 2008-04-05 22:11:50


On Sat, Apr 5, 2008 at 8:53 PM, Peter Dimov <pdimov_at_[hidden]> wrote:
> A compiler that is good at removing the iterator abstraction penalty will
> show a bigger difference between _SECURE_SCL=0 and =1, so your results
> aren't surprising. I wasn't disputing that. My point was that if one
> habitually uses pointers to traverse performance-sensitive vectors, then
> _SECURE_SCL only affects the non-performance-sensitive vector accesses,
> where one presumably doesn't mind the extra safety.
>
> (One reason for avoiding vector::iterator is fear of abstraction penalty
> that may now be obsolete and unfounded; another legitimate one, however, is
> that pointers imply contiguous storage, and algorithms can take advantage of
> that.)
>

I really dislike this. It's been hard enough to convince people that
yes, templates are just as fast as doing it manually, so anything that
prevents that from being true is, in my opinion, a misfeature --- and
contrary to the "spirit" of C++, according to my reading of D&E and
the HOPL paper.

And vector iterators also imply contiguous storage. Any good
implementation ought to specialize for that if they use
sequential-memory optimizations. As far as I'm concerned, the
implementation shouldn't be doing anything to hurt my performance by
default if I have NDEBUG defined. If I want my vectors and such
checked, I'll ask for a debug STL. The OS will already prevent me
from screwing up some other program.

YMMV,
~ Scott


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk