# Re: Benchmarking sigmoid function between C and D

```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 <kozz...@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@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.
```
```
private auto sigmoid1_perf() {
auto sw = StopWatch(AutoStart.yes);
int i;
float x, y = 0.0f;

for (i = 0; i < 10; i++) {
for (x = -5.0f; x <= 5.0f; x+=0.00001f) {
y += sigmoid1(x);
}
}
auto t = sw.peek.total!"msecs";
return tuple(y, t);
}

private auto sigmoid2_perf() {
auto sw = StopWatch(AutoStart.yes);
int i;
float x, y = 0.0f;
for (i = 0; i < 10; i++) {
for (x = -5.0f; x <= 5.0f; x+=0.00001f) {
y += sigmoid2(x);
}
}
auto t = sw.peek.total!"msecs";
return tuple(y, t);
}
```
```