Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: oops here's a better version...

Author: Koundinya Veluri

Date: 22:00:26 01/15/02

Go up one level in this thread


On January 15, 2002 at 11:48:09, Miguel A. Ballicora wrote:

>On January 15, 2002 at 06:54:38, Koundinya Veluri wrote:
>
>>On my computer, bsf is faster if the 1-bit is less significant and bsr is faster
>>if the 1-bit is more significant,

Ok first of all, I was wrong here. I was thinking one thing and saying something
else. I know nothing about how bsf and bsr works on my processor. What I meant
here was that for FirstBit, the jump version is faster if the 1-bit is in the
lower 32 bits and for LastBit, the jump versions are faster if the 1-bit is in
the higher 32 bits. I thought this was pretty obvious, until now...

>> so the FirstBit() and LastBit() versions with
>>the jumps are running faster on average. How does this test on other processors?
>>I'm curious...
>
>I think that you should check with random numbers like this
>
>for (i = 0; i < ITERATIONS; ++i) {
>   FB[i] = 1 << randomnumber(64);   /* randomnumber returns random from 0-63*/
>}
>
>Once you fill this array, you can replace in your testing FB by FB[a]
>The idea is that in your test you make things very predictable affecting
>the branches and also the amount of time the bsf/bsr might take.
>
>Regards,
>Miguel
>

You were right Miguel, if I do this, then FirstBit2() and LastBit3() are
substantially faster than the jump versions. Very interesting. It makes sense
now. Thanks for the explanation.

Regards,
Koundinya



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.