On Friday, 13 December 2013 at 12:41:53 UTC, logicchains wrote:
I've posted a couple of benchmarks involving D previously and
received complaints that the D implementation was ugly and
un-idiomatic, so I thought I'd seek code review before posting
the next one. The code is at
https://github.com/logicchains/ParticleBench/blob/master/D.d;
it's an OpenGL particle animation, and my D code is essentially
just a direct port of the C implementation. Note however that,
as the animation is gpu-bound, there's not much scope for
optimisation of the code (in hindsight, it was a pretty poor
topic for a benchmark, but hindsight always sees farthest and
whatnot).
Use std.algorithm instead of for-loops for sum calculation:
sum = reduce!"a + b"(0, frames);
I don't think you can do much about it. Most code is just OpenGL
API boilerplate or game logic.