Complete.Org: Mailing Lists: Archives: freeciv-dev: September 1999:
[Freeciv-Dev] Re: code optimization ideas
Home

[Freeciv-Dev] Re: code optimization ideas

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Freeciv Development <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: code optimization ideas
From: Peter Schaefer <schaefer@xxxxxx>
Date: Wed, 22 Sep 1999 22:02:26 +0200

Markus Linnala wrote:
> 
> I have crude patch to utilize my ideas, but note it is not
> clean, right and does not contain documentation. I really don't
> have time to complete it. I hope someone has time to clean and
> integrate best ideas to the mainstream sources.
> 
> http://www.cs.tut.fi/~maage/fc_optimization.diff.bz2
> 
> --
> //Markus


In case anybody wants to look at Markus' patch, here is a version that 
allows you to compile it versus current cvs(about 20:00 MET 22th Sep).

I omitted changes to the Makefiles etc and fixed 5 rejects.
The patch to aiunit.c was broken, i think it should work now.

It seems like the server is working, but the clients have not been
changed yet. I have made some very crude changes to map.h and map.c by
duplicating functions that had not been renamed yet in the client,
and defaulted a missing punit->tile field in some places in the client;
this means this patch is no good idea to really use for the client files
or map.h and map.c.

It occured to me that a lot of the functions that required changing
in gui-gtk should be moved up, since otherwise changes would have to 
be done for all clients. Indicator for redundancy in code ... .

About the intention of the patch .. 
I noticed there is a get_map_tile / adjust(x)*ymax+y cache ..
Does it really help ? I'm more in favor of caching the information in the 
functions
that call get_map_tile, or even caching the value of adjust(x)*ymax+y in the 
unit itself -
having both the tile cache in get_map_tile and in the unit is no good idea IMHO 
.

I'm also not sure caching everything everywhere is a good idea ?!
Like the tile in the unit, and the x y in the tile .. .

Also do not most of the calls to get_map_tile come from pathfinding ?
How about putting the terrain into an array all by itself,
and putting the stuff not needed by pathfind elsewhere ?
This would increase cache hits by only accesing the memory needed by the 
pathfind .. maybe .. .

-- 
Peter Schäfer - mailto:schaefer@xxxxxx, schaefer@xxxxxx

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