[Freeciv-Dev] Re: [Patch] simple_ai_unit_type_iterate
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
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... :)
stock
940.05
user:939.06 sys:0.65 CPU:99%
ai1
922.45
user:921.28 sys:0.62 CPU:99%
922.09
user:921.09 sys:0.66 CPU:99%
921.99
user:920.87 sys:0.72 CPU:99%
ai2
916.58
user:915.66 sys:0.64 CPU:99%
916.25
user:915.14 sys:0.82 CPU:99%
917.11
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.
-mike
ai_simple3.diff
Description: Text document
|
|