On 02/16/2011 03:36 AM, Andrei Alexandrescu wrote:
Initial: 58 seconds.
Eliminated the switch in popFront: 53s.
Replaced emplace with assignment: 23s.
Specialized emplace for non-struct types, reinserted: 23s.
Eliminated the loop in empty (replaced with return ranges[0].empty;): 17s.
I'm sure there are ways to further improve this, but there are a few
difficulties. Each pass through the loop the code must transport values from
the two arrays into a specific format and then distribute them for further
calculation. Then, upon each popFront two words must be touched because arrays
hold pointer+length, not pointer+pointer (as probably would be better since
ranges are around).
Nice analysis!
Bearophile, is clay's zip func lazy. Else, it could explain part of its
performance, don't you think?
Denis