ldexp and frexp benchmark between Mir, C and Phobos

kinke noone at nowhere.com
Wed Jan 2 09:35:39 UTC 2019


On Tuesday, 1 January 2019 at 23:36:55 UTC, Guillaume Piolat 
wrote:
> llvm_exp (defers to C runtime) gives considerable speed 
> improvement over `std.math.exp`.

My tests back then on Linux also showed new `exp(float)` being 
about half as fast as C, while the double-version was somehow 4x 
faster.

> I've tested `expf` form the VS runtime exhaustively for 32-bit 
> `float` and it showed the relative accuracy was within < 
> 0.0002% of std.math.exp,
>
> It's not concerning at all, what is more is the variability of 
> C runtime though vs a D function. Looking for speed AND control 
> :)

Then look at the implementation of exp() and you'll see that it 
uses ldexp() once. So by porting Ilya's version (or the Cephes 
one) to Phobos, I'm sure we can match the C speed for 
single-precision too.


More information about the Digitalmars-d-announce mailing list