
On 10/14/2010 8:07 AM, Jeffrey Lee Hellrung, Jr. wrote:
That's gonna be slow. Lots of testing and branching. [...] First, that quote applies directly to a join_iterator, though I'll give you that it *may* apply to my hypothetical a flat_multirange_iterator. What I'm having trouble with is it *looks* to me like you have the same tests and branches with a segmented iterator as with a flat_multirange_iterator. Comparing the nested for-loop on page 5 of the Austern paper (which is what a segmented iterator would give you) with
On 10/14/2010 1:23 AM, David Abrahams wrote: [...] the flattened while-loop on page 6 (let's replace the while-condition with true put an inserted break statement when !(node != nodes.end())), they both have the same number of iterator increments, comparisons, and assignments. What am I missing? Are compilers just able to produce better code for nested for-loops than flattened loops?
Actually, I just realized that making those loop modifications is "cheating" :/ Unless you did some kind of Java-style iteration. Whoops, - Jeff