Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: But that PC with crafty would beat Cray Blitz though

Author: Matt Taylor

Date: 16:09:42 02/13/03

Go up one level in this thread


On February 13, 2003 at 02:01:36, Vincent Diepeveen wrote:

>On February 13, 2003 at 01:47:40, Matt Taylor wrote:
>
>branchless code is not possible for gameplaying programs unless you want to
>write the shortest program in the world: printf("i resign\n");
>
>Not to mention computerchess there it is trivially not possible. Period.
<snip>

I think you are confused about the issue. I'm not talking about writing a
program that does not branch (functions, loops, if/else). I'm talking about
taking small if/else control structures inside the program and eliminating them.
Rearrangment of other if/else control structures can also be done to increase
performance. Small if/else branches are a problem because the branch mispredict
penalty is much larger than the cost of executing the code itself. Therefore it
makes more sense to execute the code and choose the result conditionally without
branching.

As an aside, loops can still be reduced/eliminated (e.g. consider computation of
Fibonacci numbers -- fib(n) can be computed with a loop -or- with phi^n), but I
don't know of any universal techniques other than loop unrolling and constant
folding.

-Matt



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.