[Freeciv-Dev] Re: Cache win_chance in get_defender(attacker) (PR#1269)
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Fri, Feb 22, 2002 at 10:00:31AM -0800, Gregory Berkolaiko wrote:
> --- Gregory Berkolaiko <gberkolaiko@xxxxxxxxxxx> wrote:
> > --- Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx> wrote:
> > > On Fri, Feb 22, 2002 at 03:34:10PM +0100, Petr Baudis wrote:
> > >
> > > > + get_total_attack_power(patt, punit) *
> > > > + get_total_attack_power(punit, pdef)
> > >
> > > Can't this test be replaced with win_chance?
> >
> > Mmmm, I got so carried away with the idea that win_chance takes too much
> > CPU,
> > that I didn't notice that here it won't be more costly...
> >
> > If, that is, we modify get_attacker and get_defender slightly to cache the
> > value of the winchance. Because all win probabilities were already computed
> > in there.
>
> And a patch to enable this.
>
> This will pave a road for a very simple patch which will make autoattack
> _significantly_ better.
>
> Of course we don't have to cache the win_chance but it is a big fat function
> to call (and we would need to call it if we want to get the attack profit
> equation absolutely right).
How will this be used? I don't see this from the patch.
If I would do such thing I would do it different from this.
I would make a cache indexed by the arguments of win_chance and place
the cache (using a hash) manage code in win_chance. This would provide
a transparent benefit for all. First and foremost however some
profiling has to be made. I haven't done profiling in a long time.
Raimar
--
email: rf13@xxxxxxxxxxxxxxxxx
"I haven't lost my mind - it's backed up on tape somewhere."
- [Freeciv-Dev] Cache win_chance in get_defender(attacker) (PR#1269), Gregory Berkolaiko, 2002/02/22
- [Freeciv-Dev] Re: Cache win_chance in get_defender(attacker) (PR#1269),
Raimar Falke <=
- [Freeciv-Dev] Re: Cache win_chance in get_defender(attacker) (PR#1269), Gregory Berkolaiko, 2002/02/22
- [Freeciv-Dev] Re: Cache win_chance in get_defender(attacker) (PR#1269), Raimar Falke, 2002/02/22
- [Freeciv-Dev] Re: Cache win_chance in get_defender(attacker) (PR#1269), Gregory Berkolaiko, 2002/02/22
- [Freeciv-Dev] Re: Cache win_chance in get_defender(attacker) (PR#1269), Raimar Falke, 2002/02/22
- [Freeciv-Dev] Re: Cache win_chance in get_defender(attacker) (PR#1269), Tony Stuckey, 2002/02/22
- [Freeciv-Dev] Re: Cache win_chance in get_defender(attacker) (PR#1269), Raimar Falke, 2002/02/22
- [Freeciv-Dev] Re: Cache win_chance in get_defender(attacker) (PR#1269), Raimar Falke, 2002/02/23
- [Freeciv-Dev] Unit-vs-stack sim (was: Cache win_chance), Gregory Berkolaiko, 2002/02/23
- [Freeciv-Dev] Re: Unit-vs-stack sim (was: Cache win_chance), Raimar Falke, 2002/02/23
- [Freeciv-Dev] Re: Unit-vs-stack sim (was: Cache win_chance), Gregory Berkolaiko, 2002/02/23
|
|