Subject: Re: [boost] lifetime of ranges vs. iterators
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2008-09-03 23:29:47
David Abrahams wrote:
> I think the optimizer can remove some redundant tests if the functions
> are inlined. But, that said, I am becoming more and more convinced as
> this discussion goes on that compressing stacked iterator adaptors is
> barking up the wrong tree if you care about efficiency. The difference
> between the code generated in the abstracted case and the code you'd
> write by hand is simply too great.
> No, I don't have a picture of a better solution yet. But it's an
> interesting problem.
Here are some measurements for my current version of filter_iterator
4 function objects containing two integers each: 3.39 seconds
4 stateless function objects: 2.813 seconds
4 stateless function objects combined using phoenix's && rather than
stacked iterators: 2.563 seconds
1 stateless function object 2.015 seconds
raw for loop using vector iterators 2.516 seconds
raw for loop using pointers: 1.703 seconds
These were all doing the same calculation over the same underlying vector.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk