Benchmarking sigmoid function between C and D

Guillaume Piolat first.last at gmail.com
Sat Apr 7 21:53:23 UTC 2018


On Saturday, 7 April 2018 at 20:33:13 UTC, Arun Chandrasekaran 
wrote:
> On Saturday, 7 April 2018 at 19:14:27 UTC, Daniel Kozak wrote:
>> or for ldc 
>> http://docs.algorithm.dlang.io/latest/mir_math_common.html
>>
>> On Sat, Apr 7, 2018 at 9:10 PM, Daniel Kozak 
>> <kozzi11 at gmail.com> wrote:
>>
>>> can you try it with c math functions?
>>>
>>> instead of std.math, try to use core.stdc.math
>>>
>>> On Sat, Apr 7, 2018 at 8:53 PM, Arun Chandrasekaran via 
>>> Digitalmars-d-learn <digitalmars-d-learn at puremagic.com> wrote:
>>>
>>>> [...]
>
> Much better with mir.math.common, still a bit slower than C 
> (even with larger loops):
>
> 10^7 iterations using sigmoid1: 168 ms
> 10^7 iterations using sigmoid2: 39 ms
>
> Also LDC optimized away the computation. So I had to modify the 
> code a bit.
>


Have you tried LLVM intrinsics? say llvm_exp


More information about the Digitalmars-d-learn mailing list