Slow performance compared to C++, ideas?
finalpatch
fengli at gmail.com
Thu May 30 21:43:24 PDT 2013
Hi,
I think you are using the version(D_SIMD) path, which is my (not
very successful) attempt at vectorizing the thing.
change the version(D_SIMD) line to version(none) and it will use
the scalar path, which has exactly the same dot() function as
yours.
On Friday, 31 May 2013 at 04:29:19 UTC, Juan Manuel Cabo wrote:
> I just shaved 1.2 seconds trying with dmd by changing the dot
> function from:
>
> float dot(in Vec3 v1, in Vec3 v2)
> {
> auto t = v1.v * v2.v;
> auto p = t.ptr;
> return p[0] + p[1] + p[2];
> }
>
> to:
>
> float dot(in Vec3 v1, in Vec3 v2)
> {
> auto one = v1.v.ptr;
> auto two = v2.v.ptr;
> return one[0] * two[0]
> + one[1] * two[1]
> + one[2] * two[2];
> }
>
> Before:
> 2 secs, 895 ms, 891 μs, and 7 hnsecs
> After:
> 1 sec, 648 ms, 698 μs, and 1 hnsec
>
More information about the Digitalmars-d
mailing list