[Freeciv-Dev] Re: [Patch] simple_ai_unit_type_iterate
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Mike Kaufman wrote:
On Fri, Mar 08, 2002 at 12:49:47PM -0500, Jason Short wrote:
Raimar Falke wrote:
On Wed, Mar 06, 2002 at 12:47:52PM +0100, Raimar Falke wrote:
It turns out that is_ai_simple_military can be computed before the
game starts. The patch does this and replaces the calls with a new
iterate. Another 2.2% speedup.
Mike provided the idea to code the iterate in another form which
should be a bit faster. However I haven't made any measurements
yet. (HINT).
Aside from the potential buffer overflow (if there are U_LAST different
units, all of which are ai_simple_military) it looks fine. Whether it's
faster or not...I'd suggest first converting the code to use the
iterator, then tweaking the iterator internals. I doubt any speed
difference will be comparable to, say, inlining a single function...
<snip comparison of times>
attached is a modified patch that actually works.
Only two complaints -
- I'm still not happy with the name.
- There is at least one comment ("not dealing with planes left") which
is removed that shouldn't be. It still applies, right?
Seems reasonable, though. I don't think it grants any *great* benefit,
code-wise, but it does shorten most things slightly.
jason
|
|