Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Speeding code

Author: Uri Blass

Date: 08:39:02 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.

You can inline the functions so there is no demage of writing functions.
The compiler should be able to translate it to the right code.

I assume that you use C or C++ in this post.

Uri



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.