Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2002:
[Freeciv-Dev] Re: (PR#2521) general effects framework
Home

[Freeciv-Dev] Re: (PR#2521) general effects framework

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: kaufman@xxxxxxxxxxxxxxxxxxxxxx
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#2521) general effects framework
From: "Per I. Mathisen via RT" <rt@xxxxxxxxxxxxxx>
Date: Mon, 9 Dec 2002 11:29:24 -0800
Reply-to: rt@xxxxxxxxxxxxxx

On Mon, 9 Dec 2002, Mike Kaufman via RT wrote:
> This is fear-mongering. Not in my worst dreams do I predict a slowdown of
> more than a factor of two. Without the AI, I predict a slowdown of less
> than 10%, if that. Less after some clever cacheing as Ben as shown.
> The clincher is the AI. Per might have some thoughts and predictions on this.

I certainly have.

In fact, as I've alluded to previously, I have a working patch that
measures building effects exactly (instead of WAG guessing what they would
do like now) by adding, comparing and removing them. I use eff_range to
avoid recomputations of the world we don't change, but apparently I can't
do that for update_all_effects(). If update_all_effects() can be dropped
buildings that don't need it, much speed increase would be gained.

In any case, the speed impact of this patch can only be measured once it
is written against the gen effects framework and a solution to
update_all_effects() is found.

Anyway, for an idea, some numbers for the current patch (which is very
very beta stage):

Normal autogame:
real    0m11.339s
user    0m10.830s
sys     0m0.110s

Patch autogame:
real    0m44.189s
user    0m42.290s
sys     0m0.870s

So barring other changes, and assuming that further optimalizations in the
above-mentioned patch will be eaten up by the actual implementations of
the gen effects, I guess ~5x slowdown is a realistic number.

* BUT *

That is only because the AI is stupid as a doorpost and recalculates the
entire world every turn. Once it learns that this is not necessary -
simple validation checks can be done on existing production, otherwise
complete what you are currently producing - and we skip building
evaluations for cases where we must build units anyway, there should be a
general speed up of the building evaluation code of about (wild guess) 10x
(since we should only need to recalculate one in 10 cities every turn).

This might offset the extra penalty from properly understanding gen
effects. But only time will tell.

Also, worst case, we may go back to meta-evaluation of building effects.
Andi Payn has already written code for that for most of gen impr, IIRC.
But I doubt that will be necessary.

  - Per




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