Reducing the cost of autodecoding

Stefan Koch via Digitalmars-d digitalmars-d at puremagic.com
Wed Oct 12 13:07:19 PDT 2016


On Wednesday, 12 October 2016 at 20:02:16 UTC, safety0ff wrote:
> On Wednesday, 12 October 2016 at 16:24:19 UTC, Andrei 
> Alexandrescu wrote:
>>
>> Remember the ASCII part is the bothersome one. There's only 
>> two comparisons, all with 100% predictability. We should be 
>> able to arrange matters so the loss is negligible. -- Andrei
>
> My measurements:
> ldc -O3  -boundscheck=off -release -mcpu=native -enable-inlining
> ldc version 1.0.0
>
> overhead 0.350s
> bytes    0.385s
> current autodecoding 0.915s (with new LUT popFront)
> copy-pasting std.utf decoding functions into current file 0.840s
> adding ASCII branch hints (llvm_expect) 0.770s
>
> With the branch hints LDC moves the non-Ascii code outside of 
> the loop and creates a really tight loop body.

where did you apply the branch hints ?


More information about the Digitalmars-d mailing list