ldexp and frexp benchmark between Mir, C and Phobos

Iain Buclaw ibuclaw at gdcproject.org
Sat Dec 29 15:15:48 UTC 2018

On Fri, 28 Dec 2018 at 20:50, 9il via Digitalmars-d-announce
<digitalmars-d-announce at puremagic.com> wrote:
> ldexp and frexp are base building blocks for a lot of math
> functions.
> Here is a small benchmark that compares Mir, C and Phobos
> implementations:
> https://github.com/libmir/mir-core/blob/master/bench_ldexp_frexp.d
> Mir ldexp is 2.5 (5.5 - dmd) times faster for double and float.

You could double the speed of ldexp if you actually used the
checkedint compiler intrinsics rather than implementing it yourself.

Using libm's ldexp() is also likely going to be 2-5x slower than using
the implementation you've written for mir.ldexp().  For one, your
version will be inlined!


More information about the Digitalmars-d-announce mailing list