Nuage wrote:
3) His patch compute gradients another way.
What is wrong is that it only check for 4 directions instead of 8. So I guess it
will help speed, but globule would not be able to walk trough a diagonal tight 
path.
This leads me to an interesting idea about the gradient computations. In updateGradientSmall you don't always have to add every neighbour of a square into the listedAddr list. If you process a square and for example the squares on the upper left and the lower left aren't obstacles you can just update the square on the left, without having to add it into the list. Every square which could be reached from there can also be reached from one of the other two squares.

I wrote a quick hack against 0.8.15 (later releases didn't compile on my machine and cvs has some strange gradient computation). It always computes the gradient in the old and my new way and then compares the results. The two gradients were always exactly the same and the gprof results are quite impressive:

on the map WaterInTheDesert:
%      self
time  seconds  calls  name
12.79 7.16       1961  Map::updateGlobalGradientSmallOld(unsigned char*)
8.11   4.54       1961  Map::updateGlobalGradientSmall(unsigned char*)

on the map migration:
10.25 4.86       1786  Map::updateGlobalGradientSmallOld(unsigned char*)
7.74   3.67       1786  Map::updateGlobalGradientSmall(unsigned char*)

If you're interested, I'll clean up my quick hack and write a patch tomorrow.

Simon


_______________________________________________
glob2-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/glob2-devel

Reply via email to