Can you shrink it further?

Stefan Koch via Digitalmars-d digitalmars-d at puremagic.com
Tue Oct 11 02:13:10 PDT 2016


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.



More information about the Digitalmars-d mailing list