Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Speed of certain operations

Author: Greg Lazarou

Date: 19:56:02 06/16/99

Go up one level in this thread


Hi James,

I don't have the straight answer to your question but if x is an integer then
multiplications by 2 and divisions by 2 (the 4th and 2nd cases respectively)
should be very fast left and right shifts. Now you can let the compiler figure
it out (and you may be able to help the compiler figure it out by expressing
x*=.5 as x /= 2) or you can code it as a shift yourself...

In general if you can keep multiplications and division by powers of 2 (2, 4, 8,
16, 32...) you can express these operations as shifts.

I don't know if this really makes that much difference but it should help a bit.
So if you are inclined to multiply by 5 or divide by 5 (lets say a factor of an
evaluation parameter), would it be ok to use 4? If so you may get a bit of
speed-up.

All this is theoretical and it would be very simple to write a small program
that does a million such operations and get some actual hard data with your
compiler and your specific hardware. But I haven't done that ;-) If you do,
please tell us what you find...

Greg

On June 16, 1999 at 22:20:19, James Robertson wrote:

>If in my evaluation function I have numerous operations such as:
>
>x *= 5;
>x *= .5;
>x /= 5;
>x /= .5;
>
>[about] how many cycles will each of these take on a P/PII?
>
>Thanks,
>James



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.