[aquaria] [patch] Some optimizations

False.Genesis false.genesis at googlemail.com
Tue Dec 13 20:02:20 EST 2011

Found a few scenarios while modding that ran really slow, and did some 
profiling to find bottlenecks. I know this is probably not really useful 
with the new engine code in sight, but has been some nice training at 
least (first time with a profiler, yay).

I used 2 testing scenarios, and the combined results with the patch are 
roughly (based on total CPU time% minus Nvidia driver minus XP kernel):

[case: Massive particle emitter + many CollideEntity's on huge map]
- Vector interpolation: 5-8%
- Game::collideCircleWithGrid() - about 3-4%

[case: Large maps (tree01, mainarea)]
- Removed hack from GridRender, 10% faster for large maps
- use memchr() instead of byte-looping: 3-4%

As the now removed hack was made only for one map, i've fixed that one 
instead: - the fixed sun temple map file can be found here:

It would be nice to improve RenderObject::matrixChain(), which I *think* 
is the main reason for LOTS of gfx driver <-> kernel spinlocking, but my 
OpenGL/math knowledge is not good enough.
I expect it to be optimized in the new code, anyways :)

Consider this patch an experiment (not experimental, it works ;) ),
throw it in if you like, or don't.
But it would be really cool if you'd at least remove the hack in 
GridRender::onRender() (currently it is #1 bottleneck in the map drawing 
code), and apply the Vector class changes.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: perf.patch
URL: <http://icculus.org/pipermail/aquaria/attachments/20111214/d938c29e/attachment-0001.diff>

More information about the aquaria mailing list