Complete.Org: Mailing Lists: Archives: freeciv-ai: February 2004:
[freeciv-ai] Re: (PR#6912) Optimize/reimplement CM: per-city caches
Home

[freeciv-ai] Re: (PR#6912) Optimize/reimplement CM: per-city caches

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [freeciv-ai] Re: (PR#6912) Optimize/reimplement CM: per-city caches
From: "Benoit Hudson" <bh@xxxxxxxxxxxxxxxxxxx>
Date: Sun, 29 Feb 2004 19:17:04 -0800
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=6912 >

On Thu, Feb 26, 2004 at 05:14:22PM -0800, Jason Short wrote:
> > BTW, I'm aware that the patch suffers from bit rot already; I can
> > provide a new patch sometime after Friday.
>
> And?

My home machine is dying a slow death and I don't feel like developing
on freeciv too much in my office :)

That said, I've submitted a couple of patches that have parts of this
patch in it.  I should be able to hammer out another per-city cache
patch pretty quickly (I'd do it right now if I were in my office).


> > Indexing via city id: what's the problem with that?  I guess if indexing
> > is the problem, then I could just use a hash table.
>
> I dunno.  AFAIK city id's are universally unique.

The one hypothetical problem I can see: if someone copies the city and
sends in a fake city with the same ID but different other attributes.
But I can't think of anything better than city-ID to index by (indexing
by memory address has its own problems).

Using an array has the problem that our storage is linear in the maximum
ID rather than in the number of cities, so I'll switch to using a hash
table now that I know that one exists.


> > Storing the parameter: what's wrong with that?  The idea of storing it
>
> Is it possible data is being overwritten, so data from one city is being
> used for another?

True -- I should be copying it rather than keeping a pointer.  I can't
think of any problem of copying the parameter, but please inform me if
it's just a lack of imagination on my part.

        -- Benoît




[Prev in Thread] Current Thread [Next in Thread]
  • [freeciv-ai] Re: (PR#6912) Optimize/reimplement CM: per-city caches, Benoit Hudson <=