Re: [Freeciv-Dev] Some performance issues
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Mitch Davis wrote:
> Rizos Sakellariou wrote:
> > As a solution,
> > i suggest to replace all occurrences of y*map.xsize with something like
> > an array ymult[y] whose elements (from 0 to map.ysize) are precomputed
> > at the beginning of each game.
>
> Having a lookup table is a good idea. We could either have a
> table with a well-known name, or a function to do a lookup. On
> compilers such as gcc, the function could be made inline.
>
> Hmm, the table sounds neater...
If we wanted to optimise for speed at the expense of some
memory, we could make map.tiles a static 2-d array with the
maximum map sizes. Presumably that would help optimisation.
(Probably talking around up to 100k memory waste, is my
guestimate, depending on the actual map size.)
Or otherwise a table should be ok. I think it should be
possible to have this stuff all localised within common/map.c
Regards,
-- David
|
|