Challenge: write a really really small front() for UTF8

Daniel N ufo at orbiting.us
Tue Mar 25 04:15:29 PDT 2014


On Tuesday, 25 March 2014 at 10:42:59 UTC, dennis luehring wrote:
>> void doStuff() {
>>      if(supportCpuFeatureX)
>>          doStuff_FeatureX();
>>      else
>>          doStuff_Fallback();
>> }
>>
>>  > dmd -inline blah.d
>
> the extra branch could kill the performance benefit if doStuff 
> is too small

you'd simply have to hoist the condition outside the inner loop.

Furthermore the branch prediction would never fail, only 
unpredictable branches are terrible.


More information about the Digitalmars-d mailing list