Yeah, again I was too hasty about the comparison. Now, whne using long int and taking the mean value of the time in julia as
I finally have these results:
| function | julia sum |
julia mysum |
cpp |
|---|---|---|---|
| L = 1E3 | 0.678 μs | 0.662 μs | 0.582 μs |
| L = 1E4 | 8.396 μs | 6.706 μs | 18.32 μs |
| L = 1E5 | 77.10 μs | 67.13 μs | 142.2 μs |
| L = 1E6 | 751.0 μs | 670.3 μs | 1435 μs |
This is nice to see for a julia user but I now wonder why cpp is so much slower here?
I don’t see a reason for it but maybe someone still sees some “bugs” in the cpp code…
The times are measured on a Intel(R) Pentium(R) CPU N3530 @ 2.16GHz.