Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: On Beowulf - long post

Author: Vincent Diepeveen

Date: 06:38:47 06/06/01

Go up one level in this thread


On June 06, 2001 at 09:33:00, martin fierz wrote:

>On June 06, 2001 at 09:31:32, martin fierz wrote:
>
>>[snip]
>>>
>>>In this piece of crap code i see everywhere:
>>>
>>>    if (side == WHITE)
>>>        tsq = B->WhiteKnights;
>>>    else
>>>        tsq = B->BlackKnights;
>>>
>>>Note you can eliminate these branches, which speeds code up bigtime.
>>[snip]
>>
>>so, who can enlighten a dummy like me? how exactly can i eliminate
>>branches like this? i admit that my checkers program has some of these
>>too... although i mostly do it like this
>>
>>if(color==WHITE)
>argh... i hit tab return instead of return, ok, again:

The logical thing to do which saves a dead slow branch is:

  tsq = globaltable[side];

Basically you can get rid of any easy branch you want to
even without using Pentiumpro instructions.

Just create some tables.

>if(color==WHITE)
> do lots of stuff
>else
> do lots of other stuff.
>
>is this still so stupid?
>
>cheers
>  martin



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.