On Sat, 24 Apr 2010 05:32:25 -0400, Joseph Wakeling
<joseph.wakel...@webdrake.net> wrote:
Steven Schveighoffer wrote:
I did a little review of the code, I concur that the code is pretty
identical, and the D version does not really do any extra allocation. I
found one place where you were using pow(x, 2) to square something in
the D version but doing it with simple multiplication in the C++
version, but that didn't account for any slowdowns when fixed. I also
saw some places where you write 0 to arrays several times, but removing
those didn't help either.
Not several times superfluously? I think I would be embarrassed if that
were true :-P
Hm... I hate to embarrass you :)
I found it while manually inlining some functions (to try and see if that
helps speed it up). So it wasn't obvious until I saw the two lines
together.
In Yzlm.objectReputationUpdate, you zero out reputationObject array, then
call super.opCall, which also zeros out reputationObject.
It's understandable that this got introduced in the D version, you are
doing something quite different than in the C++ version, swapping with
another array and you were just being thorough. I wouldn't be too
embarrassed, and I note that it doesn't affect the runtime significantly
anyways.
In spite of all this, I still remain convinced that there is nothing
inherently bad about these results, D compilers can and probably will
get better at optimizing code. That it doesn't beat a compiler which
has been in production/mainstream for many more years probably shouldn't
be surprising to any of us, even though we want D compilers to perform
the best.
Completely agree here. I was concerned based on early experience that I
was doing 'un-D-ish' things that were screwing performance, but now I'm
fairly confident that I can write OK D code. From now on it will be all
pleasure as the compilers speed things up ... :-)
Thanks and best wishes,
Good luck to you too!
-Steve