Boost logo

Boost :

Subject: Re: [boost] [iterators] Proof-of-concept for a sentinel iteratoradapter
From: Kevin Sopp (baraclese_at_[hidden])
Date: 2009-05-13 13:05:03


On Wed, May 13, 2009 at 6:50 PM, Steven Watanabe <watanabesj_at_[hidden]> wrote:
> I'm not absolutely sure about this, but from the assembler it
> looks like the call to strlen is being pulled out of the loop.

You're right, I added __attribute__((noinline)) to the test_strlen and
test_sentinel functions and I also added -DNDEBUG this time around now
I get the following times:

enter text length: 8
strlen: 0.05 2468358720
sentinel: 0.04 2468358720

enter text length: 512
strlen: 2.46 3054888576
sentinel: 2.17 3054888576

enter text length: 8096
strlen: 38.58 2775800256
sentinel: 34.09 2775800256

which shows that the sentinel version is indeed faster. It's
comforting to know that programmer intuition works after all!


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