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 01:36:19 -0600

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

blah, blah... :)

user:939.06 sys:0.65 CPU:99%

user:921.28 sys:0.62 CPU:99%

user:921.09 sys:0.66 CPU:99%

user:920.87 sys:0.72 CPU:99%

user:915.66 sys:0.64 CPU:99%

user:915.14 sys:0.82 CPU:99%

user:916.27 sys:0.55 CPU:99%

so you get a bit of a better deal going with the second way --- nothing
horribly special though.

attached is a modified patch that actually works.


Attachment: ai_simple3.diff
Description: Text document

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