Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: My miscellany of minor chess programming problems ?

Author: Mridul Muralidharan

Date: 08:52:24 08/27/05

Go up one level in this thread


Hi Rasjid ,

  Some comments from my expierence.


1) cache miss is a very bad performance killer - and sometime not very
predictable why/when.
Ofcourse , this happens as the number of arrays that you use increase - need not
necessarily be large - a lot of distantly placed smaller array which are
sparsely used can also be equally worse.

From what I find , there are places where you use arrays and where you use
computation - and the decision should be yours based on expierence.
In a tight loop running multiple times , a array can be better if it fits a
cache line.

Some of the alternatives to precomputed arrays (like for distance , etc) use
conditional expressions - which can be equally bad and sometimes worse
(depends).

So , my input on this point is - you just have to test and find it out :)
I tend to frown on alternatives which are 'big' and also containing a lot of
conditional expressions.


2) Regarding the use of flip and using conditional if(white/black) code : here
is something I use - maybe this will be slightly better ?

#define MIRRORED_POS(_side , _pos)					\
	((((_side) << 6) - ((_side) << 3)) ^ (_pos))

(I have white == 0 , black == 1 - you can ofcourse modify this for other forms).

3) I use a pv[ply][ply] approach - not 'cos it is better/easier - but since it
helps me in debugging :)
Once the engine becomes more mature , I usually skip to using a hash table
approach.
I dont like idea of maintaining duplicate info if I can help it - yes , a good
replace scheme is critical ofcoruse !
Vincent's scheme is pretty good , what is it that you did not understand in it ?

Hope this helps,
Regards,
Mridul



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.