ldexp and frexp benchmark between Mir, C and Phobos

9il ilyayaroshenko at gmail.com
Fri Dec 28 19:48:28 UTC 2018


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.

=====================
LDC, macos x64:
---------------------------
++++ float ++++
ldexp (Phobos time / Mir time) = 2.55584
ldexp (  stdc time / Mir time) = 0.773019
frexp (Phobos time / Mir time) = 1.04093
frexp (  stdc time / Mir time) = 1.748
---------------------------
++++ double ++++
ldexp (Phobos time / Mir time) = 2.49162
ldexp (  stdc time / Mir time) = 1.31868
frexp (Phobos time / Mir time) = 0.937906
frexp (  stdc time / Mir time) = 1.82241
---------------------------
++++ real ++++
ldexp (Phobos time / Mir time) = 0.999327 (LDC Phobos uses C func 
for real)
ldexp (  stdc time / Mir time) = 0.969467 (LDC Mir uses C func 
for real)
frexp (Phobos time / Mir time) = 1.02512
frexp (  stdc time / Mir time) = 1.77901

=====================
DMD, macos x64:
---------------------------
++++ float ++++
ldexp (Phobos time / Mir time) = 5.53172
ldexp (  stdc time / Mir time) = 0.535711
frexp (Phobos time / Mir time) = 2.06024
frexp (  stdc time / Mir time) = 0.739571
---------------------------
++++ double ++++
ldexp (Phobos time / Mir time) = 5.32189
ldexp (  stdc time / Mir time) = 0.772949
frexp (Phobos time / Mir time) = 2.02758
frexp (  stdc time / Mir time) = 0.637328
---------------------------
++++ real ++++
ldexp (Phobos time / Mir time) = 2.61905
ldexp (  stdc time / Mir time) = 0.803806
frexp (Phobos time / Mir time) = 1.22398
frexp (  stdc time / Mir time) = 1.08659

Best,
Ilya


This work has been sponsored by Symmetry Investments and Kaleidic 
Associates.

http://symmetryinvestments.com/
https://github.com/kaleidicassociates/





More information about the Digitalmars-d-announce mailing list