On 6/5/18 12:50 PM, DigitalDesigns wrote:
I suppose in the long run ranges do have the potential to out perform
since they do abstract but there is no guarantee they will even come
close. Having some "proof" that they are working well would ease my
mind. As this thread shows, ranges have some major issues.
Just to point it out again, Ethan's numbers:
17 ms, 891 μs, and 6 hnsecs // for loop
15 ms, 694 μs, and 1 hnsec // fill
15 ms, 570 μs, and 9 hnsecs // each
I think ranges are doing just fine. You just need the cross-module
inlining turned on.
Imagine
having some code on your machine that is very performant but on another
machine in a slightly different circumstances it runs poorly. Now, say
it is the stride issue... One normally would not think of that being an
issue so one will look in other areas and could waste times. At least
with direct loops you pretty much get what you see. It is very easy for
ranges to be slow but more difficult for them to be fast.
The same can be said even with direct loops. There are no guarantees of
course that one type of programming style is going to outperform another
on all platforms and all compilers. My experience is that things that
seem like they should be slower can sometimes be faster, and vice versa.
It depends on so many factors, and the best thing to do is test and
observe in each situation.
-Steve