Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: High performance move generation

Author: Dave Gomboc

Date: 15:12:48 11/16/99

Go up one level in this thread


On November 16, 1999 at 16:11:55, Dan Newman wrote:

>On November 16, 1999 at 06:11:48, Alexander Kure wrote:
>
>
>>A few months ago I implemented a movegenerator for 0x88 board and tried to do
>>some performance improvements so I am glad to see this thread starting ;-)
>>My pseudo move-generator app. generates 3 MNodes on a Pentium MMX 233 Mhz in
>>Vincent's position and is app. 2.5 times faster on a Pentium III 550 Mhz giving
>>7.5 MNodes (without sorting and assigning scores for a move). Far away from the
>>high score, I'm afraid ;-)
>>Unfortunately I can not show up with the code, cause I am at work right now.
>>Maybe later if requested.
>>
>>But I doubt if using a switch instead of indexing through a piece array gives
>>any performance improvement. But directly proccessing each direction (e.g. NE,
>>NW, SE, SW for Bishop) for a piece seperately instead of looping and indexing a
>>piece dependent direction array surly yields some performance improvement. While
>>this lacks elegance it improves speed.
>>I will check this out!
>
>The code certainly is ugly.  My 0x88 move generator code is 767 lines long
>and that's with a lot of macros to shorten it.  The bitboard code is at 1168
>LOC--but that also includes a check evasions generator.
>
>I don't use the switch to avoid indexing through the piece array, I just
>use it to select piece specific code.  When I look at the generated code
>I see a lot of overhead for the switch statement that isn't needed.  The
>compiler doesn't know that the argument to the switch statement will never
>be anything other than PAWN, KNIGHT, BISHOP, etc. and so tests the arg
>to see if it is out of range.  All it really needs to do is index into the
>jump table.  (Wouldn't it be nice if there were a pragma to tell the
>compiler to eliminate this test...)

If you're using MSVC, there is.  Look up "assume".

Dave



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.