[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 Sun, Mar 10, 2002 at 01:36:19AM -0600, 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...
>
> 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%
0.6% difference. But this is still a difference. So your approach is
ok.
> 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.
What was wrong?
Raimar
--
email: rf13@xxxxxxxxxxxxxxxxx
"If at first you don't succeed... well so much for skydiving."
|
|