Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2003:
[Freeciv-Dev] freeciv profile data
Home

[Freeciv-Dev] freeciv profile data

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] freeciv profile data
From: Jason Short <jshort@xxxxxxxxxxxxxx>
Date: Sun, 19 Oct 2003 21:38:39 -0400
Reply-to: jdorje@xxxxxxxxxxxx

I made a few profiles of current freeciv.

I compiled freeciv with default debugging. I also added in the -pg flag to compilation (I added it to CFLAGS in configure.in). Then I ran server/civserver with the autogame.rc, and generated profile data with gprof via "gprof server/civserver > output".

All data is in http://freeciv.org/~jdorje/profile/.

The first profile is output-orig, derived from current CVS. I haven't examined it too closely, but I imagine there's much to learn. Anyone interested in optimizing things should look over it to see where the bottlenecks are.



The other profiles aren't that useful, but I made them while I was at it. Note that any numerical comparisons are inaccurate since only one sample was taken.

Next I generated output-gentopo, with current CVS + current gen-topologies patch. This is worthless to compare to the other since execution is different. I don't know why, but I will investigate. There are some trends, however: every map operation (that calls map_pos_to_index) is somewhat more expensive.

Obviously really_generate_warmap is a candidate for optimization. So I looked at this function, and found an easy optimization. WARMAP_COST and WARMAP_SEACOST are called more than necessary. Currently these are just a few operations each, but under gen-topologies they have a few extra operations. There are two calls: WARMAP_[SEA]COST(x, y) and WARMAP_[SEA]COST(x1, y1). I made a patch to cache both values, then profiled the result. This gave a significant decrease in the runtime of that function and a very slight overall decrease. I'm not sure if cacheing either or both are worth it. I'll send more info to RT.

As a second optimization, I turned map_get_tile() into an inline function. (I first tried turning it into a macro but freeciv wouldn't compile because the global 'map' variable conflicts with some local variables.) This resulted in a 6% decrease in runtime.

jason



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