Speed kills

Guillaume Piolat via Digitalmars-d digitalmars-d at puremagic.com
Mon Feb 15 15:19:44 PST 2016


On Monday, 15 February 2016 at 22:29:00 UTC, Basile B. wrote:
> Same for std.math.lround
>
> they use the FP way while for float and double it's only one 
> sse instruction. Typically with 6 functions similar to this one:
>
>
> int round(float value)
> {
>     asm
>     {
>         naked;
>         cvtss2si EAX, XMM0;
>         ret;
>     }
> }
>
> we could get ceil/trunc/round/floor, also almost as easily 
> fmod, hypoth.
> classic but I dont get why thery're not in std.math.
>
> Goddamnit, we're in 2016.

lround and friends have been a big performance problem at times.
Everytime you can use cast(int) instead, it's way faster.


More information about the Digitalmars-d mailing list