Author: Chrilly Donninger
Date: 07:36:19 12/13/05
Go up one level in this thread
On December 12, 2005 at 15:31:07, Gerd Isenberg wrote:
>of course also saving the bestscore assignment in that case:
>
>if (val > bestscore)
>{
> if( val >= beta )
> return val; // Actually goto return-sequence.
> bestscore = val;
> if(val > alpha)
> alpha = val;
>}
>
>or what about improving branch-prediction in some way:
>
>if( val >= beta )
> return val; // Actually goto return-sequence.
>if (val > bestscore)
>{ // most likely not taken
> bestscore = val;
> if(val > alpha)
> alpha = val;
>}
The optimizing compilers are shuffling the statements around. Sometimes they
implement some very clever tricks to avoid a jumpt at all. I have not seen this
from gcc output, put Visual-C and especially the Intel compiler do amazing
tricks to avoid jumps.
As a C-programmer one has no real control. I think the only way is to run the
Code through VTune and look on the reprots.
As a rule of thumb, the condition is usually reversed by the compiler.
Chrilly
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.