Can you shrink it further?

Stefan Koch via Digitalmars-d digitalmars-d at puremagic.com
Wed Oct 12 06:39:35 PDT 2016


On Wednesday, 12 October 2016 at 13:32:45 UTC, Stefan Koch wrote:
> On Wednesday, 12 October 2016 at 12:46:50 UTC, Andrei 
> Alexandrescu wrote:
>>
>> In the second case, the compiler generates an inc for bumping 
>> the pointer and a dec for decreasing the length (small 
>> instructions). If the variable char_length is used, add/sub 
>> must be used (larger). -- Andrei

When I write code so i can keep the
str = str[1 .. str.length]
It leads to lager code overall and decreases performance.
both in table lookup and in the multi-branch code.

update:
for ldc the table-lookup code is faster 27% then the current 
popFront.
on dmd the table-lookup is 2% faster then the current popFront.

for ldc the branching code is 23% faster then the current popFront
for dmd the branching code is 20% faster then the current popFront


More information about the Digitalmars-d mailing list