stride in slices
Steven Schveighoffer
schveiguy at yahoo.com
Tue Jun 5 21:35:03 UTC 2018
On 6/5/18 5:22 PM, DigitalDesigns wrote:
> On Tuesday, 5 June 2018 at 20:07:06 UTC, Ethan wrote:
>> In conclusion. The semantics you talk about are literally some of the
>> most basic instructions in computing; and that escaping the confines
>> of a for loop for a foreach loop can let the compiler generate more
>> efficient code than 50-year-old compsci concepts can.
>
> Ok asshat! You still don't get it! I didn't say ranges would not compile
> down to the same thing! Do you have trouble understanding the English
> language?
Nope, he doesn't. Look at what you said:
"Maybe in theory ranges could be more optimal than other semantics but
theory never equals practice. "
And now you have been shown (multiple times) that in practice ranges in
fact outperform for loops. Including the assembly to prove it (which
helps with this comment: "Having some "proof" that they are working well
would ease my mind.")
So tone down the attitude, you got what you *clearly* asked for but seem
reluctant to acknowledge. Ranges are good, for loops are good too, but
not as. So maybe you should just use ranges and use the correct
optimization flags and call it a day? Or else use for loops and accept
that even though they may not run as quickly, they are "safer" to use
since some malicious coder could come along and add in sleeps inside the
std.algorithm functions.
-Steve
More information about the Digitalmars-d
mailing list