Computer Chess Club Archives


Search

Terms

Messages

Subject: When building big arrays make sense?

Author: Uri Blass

Date: 10:17:56 10/28/02


I want to know when building big arrays make sense.

I use the numbers 1-64 for the board squares(I have no mailbox arrays in my
program)

There are cases when it is clearly better not to build arrays

For example if I want to find the rank of a square then
square>>3 is clearly faster than an array and I have the following definitions
in movei(I remember that something similiar or identical is used in crafty):

#define fil0(i) ((i)&7)
#define rank0(i) ((i)>>3)

/*I used the name rank0 to do it different than a varaible with the name rank
and I used the name fil0 to do it different than varaible with the name fil when
file has a meaning that I do not mean here*/

My question is if array is the fastest way to do other things like finding if a
rook move is pseudo legal.

rook move is pseudo legal if the file is the same file or the rank is the same
rank(I can ignore the case when both are the same because this case never happen
and I never expect hash move or killer move when both are the same even in case
of hash collision)

The question is if it is faster to use 64*64 array or not to use it and simply
check if the file or the rank is the same.

Rook is relatively simple case
What is the fastest way about king or queen or knight(should I use 64*64 array?)

I can check by comparing speed but I can sometimes see cases when movei becomes
slower inspite of planning it to work slightly faster thanks to compiler
optimizations so I do not trust a single speed comparison and I want a general
rule that is going to tell me when it is better to use arrays.

Uri



This page took 0.01 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.