gnugo-devel
[Top][All Lists]
Advanced

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

Re: [gnugo-devel] speed optimization continues


From: Gunnar Farneback
Subject: Re: [gnugo-devel] speed optimization continues
Date: Fri, 04 Oct 2002 21:52:19 +0200
User-agent: EMH/1.14.1 SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.3 Emacs/20.7 (sparc-sun-solaris2.7) (with unibyte mode)

Paul wrote:
> the next patch from the series. it changes compute_primary_domains()
> and is_lively() from optics.c. total engine speed up is about 1% :(
> lower than i expected) but without a good profile the estimation may
> be not very precise.
> 
> the main thing that makes it faster is simplification of
> sufficient_influence() macro. it still does the same, but with two
> arrays instead of one it is pretty faster.
> 
> must be no regression changes (i did test it with optics.tst and
> owl.tst and couple of other test files).

This patch is broken, as commented below. When trying to fix it in the
obvious way two optics test cases fail.

./regress.sh . optics.tst 
322 unexpected FAIL: Correct '0 2 G17 G17', got '0 1 G17 G17'
1807 unexpected FAIL: Correct '1 2 F11 (F11|H8|F8)', got '1 1'

> -  int found_one;
> -  int i, j;
> -  int pos;
> -  int inhibit[BOARDMAX];

The inhibit array disappears here...

> +  int i, j, k;
> +  int pos, pos2;
> +  int own, enemy;
> +  char threshold[BOARDMAX];
> +  signed char influence[BOARDMAX];
> +  int list[BOARDMAX], size = 0, lastchange;

and never reappears (but is still used).

> +      if (ON_BOARD(pos2) && lively[pos2])
> +        if (board[pos2] == color)
> +         own = 1;
> +       else
> +         enemy = 1;

gcc gives a "warning: suggest explicit braces to avoid ambiguous `else'"

> +      else if (k == lastchange)
> +        break; /* Looped the whole list and found nothing new */

It's not obvious that lastchange is initialized when reaching this
test, and the compiler warns about it.

/Gunnar




reply via email to

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