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

Piotr Szturmaj bncrbme at jadamspam.pl
Tue Mar 25 20:22:35 PDT 2014


W dniu 2014-03-25 11:42, dennis luehring pisze:
> Am 25.03.2014 11:38, schrieb Nick Sabalausky:
>> On 3/25/2014 4:00 AM, Iain Buclaw wrote:
>>> On 25 March 2014 00:04, Daniel N <ufo at orbiting.us> wrote:
>>>> On Monday, 24 March 2014 at 12:21:55 UTC, Daniel N wrote:
>>>>>
>>>>> I'm currently too busy to submit a complete solution, but please
>>>>> feel free
>>>>> to use my idea if you think it sounds promising.
>>>>
>>>>
>>>> I now managed to dig up my old C source... but I'm still blocked by
>>>> dmd not
>>>> accepting the 'pext' instruction...
>>>>
>>>> 1) I know my solution is not directly comparable to the rest in this
>>>> thread(for many reasons).
>>>> 2) It's of course trivial to add a fast path for ascii... if desired.
>>>> 3) It throws safety and standards out the window.
>>>>
>>>
>>>
>>> 4) It's tied to one piece of hardware.
>>>
>>> No Thankee.
>> 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

void function() doStuff;

void main() {
     auto supportCpuFeatureX = detectCpuFeatureX();

     if (supportCpuFeatureX)
         doStuff = &doStuff_FeatureX;
     else
         doStuff = &doStuff_Fallback;
}



More information about the Digitalmars-d mailing list