[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnugo-devel] another speed optimization

From: Paul Pogonyshev
Subject: [gnugo-devel] another speed optimization
Date: Tue, 24 Sep 2002 20:33:14 +0300

here is another speed optimization patch. it concerns fastlib() and
count_common_libs() functions. i also changed find_common_libs() in
the same way as count_common_libs() although it's never used.

it takes forever to run a test under visual c++ profiler, so i checked
the total time to regress certain test files instead. i checked that
every change i made gave some speed up.

here are the results (unit is approximately 1/18.2 of second), used
release build with asserts turned on:

                      without patch     with patch      speed gain
  owl_rot.tst          326 - 327        322 - 323       1 - 1.5 %
  dniwog.tst          1255 - 1256      1232 - 1234      1.7 - 2 %
  nngs.tst               21815            21251        around 2.5%

first two test files were regressed multiple times to avoid inaccuracy
due to file caching etc. patched version was run first with nngs.tst,
so it had worse cache. 2.5% looks too optimistic (for some random
factor), maybe it should be about 2%.

regression delta must be zero of course.

  - use COUNTSTONES(ally1) instead of countstones(ally1) in fastlib()
    since ally1 is guaranteed to be position of an own stone.
  - use neighbor_of_string() instead of liberty_of_string() in
    fastlib() for similar reason.
  - two speed optimizations in count_common_libs().


p.s. another small speed increase can be gained by using "light"
     version of UNMARKED_LIBERTY macro - without board[pos] == EMPTY
     check and probably some similar changes. sometimes we use the
     macro although we know that board position is empty.

reply via email to

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