[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [glob2-devel] Optimization suggestions (Map::updateLocalGradient())
From: |
Joe Wells |
Subject: |
Re: [glob2-devel] Optimization suggestions (Map::updateLocalGradient()) |
Date: |
Tue, 04 Sep 2007 21:25:23 +0100 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) |
Erik Søe Sørensen <address@hidden> writes:
> Hello,
> I have been doing some profiling on Globulation 2, and found some useful
> results.
> (I began doing this because the Ubuntu release (0.8.21) had periods of
> 100% CPU activity, but that seems to have been fixed :-)
>
> Map::updateLocalGradient() seems to be a bottleneck (~40% of the time
> spent there).
> In this function, there are at least two opportunities for speed
> improvement.
>
> For 21% improvement (of the function's run time), get rid of the array
> introduced in Map.cpp:3889:
Thank you very much!!!!
Please continue to do this with new releases!!!
This is great!!!
By the way, can you please write a short profiling “how to” explaining
what exact commands you typed to obtain this information? That would
be really helpful (because on different machines and/or with different
configuration options different portions of the code might be the
worst spots, so it would be nice if other people could easily do the
same profiling).
--
Joe
> (This happens at several other locations, by the way... the second-worst
> place in Map.cpp appears to be in Map::updateRessourcesGradient(), and
> it'might also be worth the attention :-)
>
> And another thing, now we're at reading code:
> A couple of places in Map::updateLocalGradient(), there is code like this:
> if (xxi<0)
> xxi=0;
> else if (xxi>31)
> xxi=31;
> if (yyi<0)
> yyi=0;
> else if (yyi>31)
> xxi=31; // <-- Shouldn't this be yyi??
> That last line does look like a typo (or more likely a copy'n'paste error?).
>
> Regards,
> Erik Søe Sørensen
>
> PS: Great looking game, by the way! :-)
>
>
> [Profiling done on a ThinkPad, CPU: Intel(R) Pentium(R) M processor
> 1300MHz stepping 05]
> [Today's lesson: Don't begin profiling on a non-optimized build.]
- [glob2-devel] Optimization suggestions (Map::updateLocalGradient()), Erik Søe Sørensen, 2007/09/04
- Re: [glob2-devel] Optimization suggestions (Map::updateLocalGradient()), Martin Voelkle, 2007/09/04
- Re: [glob2-devel] Optimization suggestions (Map::updateLocalGradient()),
Joe Wells <=
- Message not available
- Re: [glob2-devel] Optimization suggestions (Map::updateLocalGradient()), Erik Søe Sørensen, 2007/09/05
- [glob2-devel] More Map code improvements, Erik Søe Sørensen, 2007/09/05
- Re: [glob2-devel] More Map code improvements, Kai Antweiler, 2007/09/05
- Re: [glob2-devel] More Map code improvements, Bradley Arsenault, 2007/09/05
- Re: [glob2-devel] More Map code improvements, Kai Antweiler, 2007/09/05
- documentation for gradients (was: [glob2-devel] More Map code improvements), Joe Wells, 2007/09/05
- Re: documentation for gradients (was: [glob2-devel] More Map code improvements), Kieran P, 2007/09/06
- Re: [glob2-devel] Optimization suggestions (Map::updateLocalGradient()), Kai Antweiler, 2007/09/05
- Re: [glob2-devel] Optimization suggestions, Erik Søe Sørensen, 2007/09/05
- Re: [glob2-devel] Optimization suggestions, Erik Søe Sørensen, 2007/09/05