stride in slices

DigitalDesigns DigitalDesigns at gmail.com
Tue Jun 5 22:20:08 UTC 2018


On Tuesday, 5 June 2018 at 19:18:15 UTC, Adam D. Ruppe wrote:
> On Tuesday, 5 June 2018 at 19:05:27 UTC, DigitalDesigns wrote:
>> For loops HAVE a direct cpu semantic! Do you doubt this?
>
> What are they?
>
> And for bonus points, are they actually used by compilers?
>
> Then the final question: is the generated code any different 
> than inlined ranges?

It doesn't matter! The issue that I said was not that ranges were 
slower but that ranges exist on an abstract on top of language 
semantics! that means that they can never be faster than the 
language itself! Anything that a range does can never be faster 
than doing it by hand.

This is not a hard concept to understand. I know everyone wants 
to defend their precious ranges but what happens is irrelevant in 
some particular case. Ranges could be 100x faster in some 
specific case but it doesn't change the fact that they are an 
abstraction on top of the language, not in the language.

I've already pointed out, and made it clear, I will do it one 
last time:

There is no guarantee(doesn't have to be 100% by the rule of god) 
by the compiler that a ranges performance will even come close to 
hand written code or that it won't all of a sudden change when 
someone decides to "optimize" it and actually makes it worse! 
These problems are far less likely to occur in a well established 
language semantic.

I can't believe people are really defending library solutions as 
not having these issues, but I guess that is the nature of most 
humans.



More information about the Digitalmars-d mailing list