Disappointing math performance compared to GDC

Gabor Mezo via digitalmars-d-ldc digitalmars-d-ldc at puremagic.com
Wed Oct 8 00:37:13 PDT 2014


Hello,

I have a machine learning library and I'm porting it from C++ to 
D right now.

There is a number crunching benchmark in it that doing a simple 
gradient descent learning on a small multilayer perceptron neural 
network. The core of the benchmark is about some loops doing 
basic computations on numbers in float[] arrays (add, mul, exp, 
abs).

The reference is the C++ version compiled with Clang: 0.044 secs.

D results:

DMD 2.066 -O -release -inline -boundscheck=off : 0.06 secs
LDC2 0.14 -O3 -release                         : 0.051 secs
GDC 4.9 -O3 -release                           : 0.031 secs

I think my benchmark code would hugely benefit from auto 
vectorization, so that might be the cause of the above results. 
I've found some vectorization compiler options for ldc2 but they 
seems have no effect on performance whatsoever.

Any suggestions?



More information about the digitalmars-d-ldc mailing list