Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2002:
[Freeciv-Dev] Re: [Patch] simple_ai_unit_type_iterate

[Freeciv-Dev] Re: [Patch] simple_ai_unit_type_iterate

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: [Patch] simple_ai_unit_type_iterate
From: Mike Kaufman <kaufman@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 10 Mar 2002 10:23:23 -0600

On Sun, Mar 10, 2002 at 04:15:58AM -0500, Jason Short wrote:
> 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.

I'm not all that enthusiastic either. So someone come up with one.


> - 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.

you take it where you can get it.


> jason

[Prev in Thread] Current Thread [Next in Thread]