ldexp and frexp benchmark between Mir, C and Phobos

9il ilyayaroshenko at gmail.com
Sat Dec 29 16:32:54 UTC 2018


On Saturday, 29 December 2018 at 15:15:48 UTC, Iain Buclaw wrote:
> 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!

Mir has support for LLVM checkedint intrinsics. GDC checkedint 
intrinsics are not yet integrated in Mir.

https://github.com/libmir/mir-core/blob/master/source/mir/checkedint.d


More information about the Digitalmars-d-announce mailing list