Is there any overhead iterating over a pointer using a slice?
Adam D. Ruppe via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue May 31 11:56:55 PDT 2016
On Tuesday, 31 May 2016 at 18:55:18 UTC, Gary Willoughby wrote:
> Is there any overhead compared with pointer arithmetic in a for
> loop?
Very very little. The slice will ensure start and stop indexes
are in bounds before the loop (and throw an RangeError if it
isn't), but inside the loop, it should generate exactly the same
code.
More information about the Digitalmars-d-learn
mailing list