Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Begging for assembler FirstOne() and LastOne()

Author: Dann Corbit

Date: 15:36:50 05/20/02

Go up one level in this thread


On May 19, 2002 at 08:35:32, Matthias Gemuh wrote:

>On May 19, 2002 at 06:50:35, Gerd Isenberg wrote:
>
>>This one don't need conditional jumps:
>>
>>// precondition: bb not null
>>__forceinline unsigned int BitSearch(BitBoard bb)
>>{
>>	__asm
>>	{
>>		bsf		eax,[bb+4]
>>		xor		eax, 32
>>		bsf		eax,[bb]
>>	}
>>}
>>
>>__forceinline unsigned int BitSearchReverse(BitBoard bb)
>>{
>>	__asm
>>	{
>>		bsr		eax,[bb]
>>		bsr		eax,[bb+4]
>>		setnz	dl
>>		shl		dl, 5
>>		add		al, dl
>>	}
>>}
>>
>>Gerd
>
>
>
>Thanks, Gerd.
>These also work fine.
>I shall match the functions against their C versions and see by how much
>assembler wins the race. I hope my engine will no go from 70 kn/s to 700 kn/s
>:-).

I find it hard to imagine a C getfirstbit/getlast bit function ten times slower
than the assembly counterpart.  Realistically, the best you can possibly hope
for is a 2x speedup, and that would probably take a 4x speedup in the
bit-routine rate.  Even if it is a true bottleneck, as soon as it is reduced to
some point another bottleneck will dominate instead.

To find a 10x performance jump will require changes in fundamental algorithm, I
think.  On the other hand, 700K NPS is a realistic figure to strive for, since
many engines can achieve that speed during search.



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.