Speed of math function atan: comparison D and C++

rikki cattermole rikki at cattermole.co.nz
Mon Mar 5 05:40:09 UTC 2018


On 05/03/2018 6:35 PM, J-S Caux wrote:
> I'm considering shifting a large existing C++ codebase into D (it's a 
> scientific code making much use of functions like atan, log etc).
> 
> I've compared the raw speed of atan between C++ (Apple LLVM version 
> 7.3.0 (clang-703.0.29)) and D (dmd v2.079.0, also ldc2 1.7.0) by doing 
> long loops of such functions.
> 
> I can't get the D to run faster than about half the speed of C++.
> 
> Are there benchmarks for such scientific functions published somewhere

Gonna need to disassemble and compare them.

atan should work out to only be a few instructions (inline assembly) 
from what I've looked at in the source.

Also you should post the code you used for each.


More information about the Digitalmars-d-learn mailing list