Boost logo

Boost Users :

From: Thomas Matelich (matelich_at_[hidden])
Date: 2007-08-01 11:10:10


On 7/31/07, Eric Niebler <eric_at_[hidden]> wrote:
>
> Thomas Matelich wrote:
> > So, I'm loving Foreach and as I watch it spread throughout our
> > codebase, of course it runs across the desk of our optimization
> > obsessed team member. So, I was curious if you could address runtime
> > performance of Foreach. I would expect it to be essentially
> > equivalent to a hand written for loop with caching of end(). But
> > what's the overhead of the auto_any_t, etc.?
>
> FOREACH is ~5% slower than the equivalent hand-coded loop, but for most
> loops (e.g., that have non-empty loop bodies) the small overhead is lost
> in the noise. What overhead there is is due to an extra test/set of a
> boolean at each loop iteration.
>
> You can find some performance comparisons here: http://tinyurl.com/2loc29
>

Thanks for the info. /me happily evangelizes Foreach throughout the group.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net