On Tuesday, 11 October 2016 at 08:57:46 UTC, Stefan Koch wrote:
On Tuesday, 11 October 2016 at 08:44:04 UTC, Temtaime wrote:
void popFront1(ref char[] s) @trusted pure nothrow
{
import core.bitop, std.algorithm;
auto v = bsr(~s[0] | 1);
s = s[clamp(v, 1, v > 6 ? 1 : $)..$];
}
Seems to be less if i'm not wrong.
Yours runs with 790 us best time.
bsr is a real timetaker :)
CORRECTION this is not bsr's fault.
It's most likely clamp.
I am compiling with dmd and dmd is not as good in optimizing when
templates are in the mix.