On Thursday, 25 May 2017 at 18:13:15 UTC, Anonymouse wrote:

Part of the strings I'm working with can be assumed to be only ASCII, yes. indexOf only wants strings or char[]s, but interestingly if I use the same benchmark but have countUntil work on raw ubyte[]s, it is faster. See https://dpaste.dzfl.pl/2e095f7d18be.

There's a less ugly cast in std.string:

import std.string : representation;

//(cast(ubyte[])line).countUntil(cast(ubyte[])" :");
line.representation.countUntil(" :".representation);

Reply via email to