Why is D slower than LuaJIT?

Simen kjaeraas simen.kjaras at gmail.com
Thu Dec 23 05:25:38 PST 2010


bearophile <bearophileHUGS at lycos.com> wrote:

> Simen kjaeraas:
>
>> With floating-point numbers, the above solution does not always work.
>
> The type is known at compile time, so you can split the algorithm in two  
> with a "static if", and do something else if it's an integral type.

Absolutely. However, in this example doubles were used.

Also, though it may be doable for integers, other types may also want
that optimization (BigInt comes to mind). A behavesAsIntegral!T might
fix that.

-- 
Simen


More information about the Digitalmars-d mailing list