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.

Reply via email to