faster splitter

David Nadlinger via Digitalmars-d digitalmars-d at puremagic.com
Fri May 27 14:31:48 PDT 2016


On Friday, 27 May 2016 at 14:06:09 UTC, Chris wrote:
> I have to correct myself. A manual loop is faster, I couldn't 
> believe it either, so I benchmarked the same function with 
> `foreach` and `for`. Turns out that `for` is _way_ faster.

Just about the only reason I could think of for this to happen is 
if the compiler fails to inline the range primitives from 
std.array. Otherwise, the loops should be pretty much equivalent 
to LLVM's optimiser.

This is so fundamental to D's strategic promise that we can't 
afford to get it wrong.

  — David


More information about the Digitalmars-d mailing list