Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: On Beowulf - long post

Author: Dan Newman

Date: 12:13:02 06/06/01

Go up one level in this thread


On June 06, 2001 at 12:00:06, Robert Hyatt wrote:

>On June 06, 2001 at 09:38:47, Vincent Diepeveen wrote:
>
>>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];
>>
>
>
>:)
>
>That replaces a "dead slow branch" with a "dead slower memory reference".
>
>some replacement.
>

Yes, I'd rather do a little calculation than reference memory.  Still,
wouldn't

    tsq = B->Knights[side];

tend to be a little faster than

    if( side == WHITE )
        tsq = B->WhiteKnights;
    else
        tsq = B->BlackKnights;

since in both cases you have to get at "side" and one of those two bitmaps?

Of course you might rather have all the bitmaps of a given color bunched
together to help with the caching...

-Dan.

>
>
>
>>Basically you can get rid of any easy branch you want to
>>even without using Pentiumpro instructions.
>>
>>Just create some tables.
>
>Tables == bandwidth.  The PC has none.
>
>
>
>>
>>>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.