[Freeciv-Dev] server/settlers.c cleanup 2
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
This cleanup introduces slight behaviour changes (cumulative, though, so
autogames get totally different). This is due to the reformulation of
amortize taken from an old patch I found lying around in the archives.
The new amortize is not _exactly_ identical to the old. I ran it through
two for loops from 0 to 999 to test all possible want values and a more
than reasonable range of possible delays (what would last > 999 turns?).
The result: 907159 calls produce the same result, 90842 are different;
of those, 415 are more than 1 off, none are more than 2 off.
Sum of all results, old amortize: 1087167885
Sum of all results, new amortize: 1087077186
I'd say that is an acceptable approximation to the behaviour of the old
amortize.
I timed the tests, and old amortize performed as follows:
real 0m0.770s
user 0m0.740s
sys 0m0.000s
The new amortize as follows:
real 0m0.549s
user 0m0.550s
sys 0m0.000s
Strange, huh? Lesson: It is difficult to outsmart a good compiler and a
modern CPU with performance hacks.
This new amortize should easier to understand, and allows MORT to have
other values than 24. I intend to write a patch to take advantage of this
when/if this patch reaches the safe shores of cvs.
(We can even start to experiment a little with pitfight games where we
have different MORT for different players, to see if 24 really is as
optimal as Syela thought. Though I know that 24 is hardcoded in several
places still.)
BTW, new amortize with dynamic MORT performs as follows:
real 0m0.602s
user 0m0.600s
sys 0m0.000s
Yours,
Per
"Treason doth never prosper: what's the reason?
Why, if it prosper, none dare call it treason."
-- Sir John Harrington (1561-1612)
settlerscleanup2.patch
Description: Text document
- [Freeciv-Dev] server/settlers.c cleanup 2,
per <=
- [Freeciv-Dev] server/settlers.c cleanup 3, Per I Mathisen, 2002/04/13
- [Freeciv-Dev] Re: server/settlers.c cleanup 3, Raahul Kumar, 2002/04/13
- [Freeciv-Dev] Re: server/settlers.c cleanup 3, Ross W. Wetmore, 2002/04/14
- [Freeciv-Dev] Re: server/settlers.c cleanup 3, Raimar Falke, 2002/04/14
- [Freeciv-Dev] Re: server/settlers.c cleanup 3, Per I. Mathisen, 2002/04/14
- [Freeciv-Dev] Re: server/settlers.c cleanup 3, Raimar Falke, 2002/04/14
- [Freeciv-Dev] Re: server/settlers.c cleanup 3, Per I Mathisen, 2002/04/14
- [Freeciv-Dev] Re: server/settlers.c cleanup 3, Mike Kaufman, 2002/04/14
- [Freeciv-Dev] Re: server/settlers.c cleanup 3, Raimar Falke, 2002/04/14
- [Freeciv-Dev] Re: server/settlers.c cleanup 3, Ross W. Wetmore, 2002/04/14
|
|