Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Speeding code

Author: Jaime Benito de Valle Ruiz

Date: 09:57:29 05/12/03

Go up one level in this thread


On May 12, 2003 at 10:38:57, Fermin Serrano wrote:

>Programming my engine I have same doubts (many, only post same concerning
>speed):
>	Question 1:
>	-----------------
>	I would like to know how jumps can slow down my engine. I mean, if I have a
>function like this:
>
>	int eval () {
>		r1 = {	code to analyze knight position 	}
>		r2 = {	code to analyze bishop			}
>		etc
>		return r1[side]-r1[c_side]+r2[side]-r2[c_side]+ .... etc
>	}
>
>	if I replace r1 = eval_knight_position(), r2=eval_bishop_position(), etc....
>how many could this slow down the code? I think this obviously is slower because
>it add jump and stack code, but is better in terms of clarity and code
>organization... so I want to know the speed efects and know when to apply
>functions calls or paste same code.
>
>	Question 2:
>	-----------------
>	Are 'and' operations faster than == operator?.
>	I can use "if (flag == TRUE)" or "if (flag & TRUE)" with the same effect. What
>is faster?

        Lo primero es probablemente mas rapido, al menos en mi Microsoft Visual
C++.

>
>	Question 3:
>	-----------------
>	To copy a structure into other, what is faster, doing by copy each of his
>elements or use a memcpy?

        Depende

>
>	Question 4:
>	-----------------
>	Does any of you use assambler code for any part of your engine code? why? what
>part?

        Sobre todo para operaciones con bits si usas bitboards: Para localizar
la posicion de un bit puesto a 1 (ej: 00100000 -> bit 5) y para contar el numero
de bits en un registro (algunos programas).

>
>
>
>	I Know algorithm implementations is by far the most important thing to speed
>the programs.
>        Thanks in advance.



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.