Computer Chess Club Archives


Search

Terms

Messages

Subject: Speeding code

Author: Fermin Serrano

Date: 07:38:57 05/12/03


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?

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

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



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





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.