Performance issue with @fastmath and vectorization

Nicholas Wilson via digitalmars-d-ldc digitalmars-d-ldc at puremagic.com
Fri Nov 11 23:38:16 PST 2016


On Saturday, 12 November 2016 at 00:03:16 UTC, dextorious wrote:
> As part of slowly learning the basics of programming in D, I 
> ported some of my fluid dynamics code from C++ to D and quickly 
> noticed a rather severe performance degradation by a factor of 
> 2-3x. I've narrowed it down to a simple representative 
> benchmark of virtually identical C++ and D code.
>
> [...]

you can apply attributes to whole files with
@fastmath:

void IamFastMath(){}

void SoAmI(){}

Don't know about whole program.

i got some improvements with -vectorize-loops and making the 
stencil array static and passing by ref. I couldn't get it to 
unroll the inner loop though.


More information about the digitalmars-d-ldc mailing list