Author: Magoo
Date: 14:01:40 05/12/03
Go up one level in this thread
On May 12, 2003 at 15:33:49, Dann Corbit wrote:
>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.
>
>Mispredicted branches are very expensive. You can eliminate some of them by
>keeping separate piece lists by type.
>
>> 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?
>
>Write the one that is the most clear. Attempted optimizations of this type are
>a big mistake.
>
>> Question 3:
>> -----------------
>> To copy a structure into other, what is faster, doing by copy each of his
>>elements or use a memcpy?
>
>The difference will be very small, either way.
>
>> Question 4:
>> -----------------
>> Does any of you use assambler code for any part of your engine code? why? what
>>part?
>
>Usually, this is reserved for some low level bit operations such as population
>count, firstbit, etc.
>
>> I Know algorithm implementations is by far the most important thing to speed
>>the programs.
>
>That is the third most important thing.
>
>The most important thing is to make the code as correct as possible.
>The second most important thing is to make the code as clear as possible.
>
>After achieving #1 and #2, then you should profile.
>After you profile, you will know what needs a push.
>
>IMO-YMMV
i agree.
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.