[Freeciv-Dev] patch: (4/4) idex - generalize citycache (PR#342)
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
The fourth in a set of 4 patches.
This is the one which actually does something interesting :-)
This patch generalises the city "citycache" into "idex" = "ident index"
for both cities and units, in both server and client. This is done
using hashes from id values to pointers (separate hashes for cities
and units, for code simplicity).
This patch _doesn't_ actually result in any significant speedup for a
typical game, because it turns out (eg, profiling) that typically id
lookups do not currently contribute significantly to overall time
(at least for one reasonably large game I tried). However I still
think this patch is a good idea, because, eg:
- In future may make more use of ids (eg, "safe pointers"), especially
after this patch makes lookups faster (O(1)).
- Could now remove limit that id values fit into unsigned short,
without consequence of citycache array becoming potentially very large
in server. (Ie, idex hash size will be based on number of elements,
but not on highest id value.) This would allow declaring that id
values are never re-used, simplifying things in server/client
- In client, probably no longer need optimisation of
improvement_upkeep_asmiths() (in city.c). This is good because
this optimisation is probably impractical with future generalised
Description: GNU Zip compressed data
- [Freeciv-Dev] patch: (4/4) idex - generalize citycache (PR#342),
David Pfitzner <=