Author: Landon Rabern
Date: 23:35:32 05/07/00
Go up one level in this thread
On May 08, 2000 at 01:52:18, David Blackman wrote:
>On May 08, 2000 at 00:32:39, Robert Hyatt wrote:
>
>>On May 07, 2000 at 19:27:11, Landon Rabern wrote:
>>
>>>When compiling with Maximize Speed on in release mode in MSVC++ 6.0 I run at
>>>about 190,000 nps, but in DJGPP with max optimizations I can get around 330,000
>>>nps in the same position. Isn't Visual C++ supposed to be faster? Any ideas on
>>>whats going on?
>>>
>>>Thanks,
>>>
>>>Landon W. Rabern
>>
>>
>>I would suspect you are not getting all the MSVC optimizations turned on
>>correctly. It is clearly better than GCC...
>
>It does depend a bit on what the program is doing. There are apparently some
>looks that GCC does a better job on. To get such a big advantage for GCC on a
>whole program would be extremely unusual though. Is this a well-known program?
>Otherwise it might be interesting to post a couple of small fragments that you
>think are the "inside loops" of the program, so we can see if you are doing
>anything unusual that might favour GCC.
Well according to the profile, this block takes up the most time.
ne++;
int i;
int value=-2000000;
int oldA=a;
int zeroPVmove=0,zeroHashMove=0;
Tmove hashMove;
Tboard *hold=(Tboard*)malloc(sizeof(Tboard));
if (usePV){
if (pseudoLegal(brd,pv[0][ply])){
hashHits++;
usePV=1;
*hold=*brd;
makeMove(hold,pv[0][ply]);
if (!check(hold,side)){
value=-computerRecurse(hold,ply+1,depth-1,-side,-b,-a);
if (value>a){
if (value>=b){
usePV=0;
setHash(brd,value,depth,LOWER,pv[0][ply],side);
free(hold);
return value;
}
a=value;
pv[ply][ply]=pv[0][ply];
for(i=ply+1;i<pvLength[ply+1];i++)
pv[ply][i]=pv[ply+1][i];
pvLength[ply]=pvLength[ply+1];
}
}
zeroPVmove=1;
}
usePV=0;
}else{
hashMove=getMove(brd,side);
if (pseudoLegal(brd,hashMove)){
hashHits++;
*hold=*brd;
makeMove(hold,hashMove);
if (!check(hold,side)){
value=-computerRecurse(hold,ply+1,depth-1,-side,-b,-a);
if (value>a){
if (value>=b){
setHash(brd,value,depth,LOWER,hashMove,side);
free(hold);
return value;
}
a=value;
pv[ply][ply]=hashMove;
for(i=ply+1;i<pvLength[ply+1];i++)
pv[ply][i]=pv[ply+1][i];
pvLength[ply]=pvLength[ply+1];
}
}
zeroHashMove=1;
}
}
Tmove *moveList=(Tmove *)malloc(MAXMOVES*sizeTmove);
int num=genCaps(brd,moveList);
if (zeroPVmove)
for(i=0;i<num;i++){
if (pv[0][ply]==moveList[i]){
moveList[i]=0;
zeroPVmove=0;
break;
}
}
if (zeroHashMove)
for(i=0;i<num;i++){
if (hashMove==moveList[i]){
moveList[i]=0;
zeroHashMove=0;
break;
}
}
while (num>0){
num--;
if (moveList[num]!=0){
*hold=*brd;
makeMove(hold,moveList[num]);
if (!check(hold,side)){
value=-computerRecurse(hold,ply+1,depth-1,-side,-b,-a);
if (value>a){
if (value>=b){
setHash(brd,value,depth,LOWER,moveList[num],side);
free(moveList);
free(hold);
return value;
}
a=value;
pv[ply][ply]=moveList[num];
for(i=ply+1;i<pvLength[ply+1];i++)
pv[ply][i]=pv[ply+1][i];
pvLength[ply]=pvLength[ply+1];
}
}
}
}
int zeroFirstKiller=0;
if (pseudoLegal(brd,killer[0][ply])){
*hold=*brd;
makeMove(hold,killer[0][ply]);
if (!check(hold,side)){
value=-computerRecurse(hold,ply+1,depth-1,-side,-b,-a);
if (value>a){
if (value>=b){
setHash(brd,value,depth,LOWER,killer[0][ply],side);
free(moveList);
free(hold);
return value;
}
a=value;
pv[ply][ply]=killer[0][ply];
for(i=ply+1;i<pvLength[ply+1];i++)
pv[ply][i]=pv[ply+1][i];
pvLength[ply]=pvLength[ply+1];
}
}
zeroFirstKiller=1;
}
int zeroSecondKiller=0;
if (pseudoLegal(brd,killer[1][ply])){
*hold=*brd;
makeMove(hold,killer[1][ply]);
if (!check(hold,side)){
value=-computerRecurse(hold,ply+1,depth-1,-side,-b,-a);
if (value>a){
if (value>=b){
setHash(brd,value,depth,LOWER,killer[1][ply],side);
free(moveList);
free(hold);
return value;
}
a=value;
pv[ply][ply]=killer[1][ply];
for(i=ply+1;i<pvLength[ply+1];i++)
pv[ply][i]=pv[ply+1][i];
pvLength[ply]=pvLength[ply+1];
}
}
zeroSecondKiller=1;
}
num=genMoves(brd,moveList);
if (zeroPVmove)
for(i=0;i<num;i++){
if (pv[0][ply]==moveList[i]){
moveList[i]=0;
break;
}
}
if (zeroHashMove)
for(i=0;i<num;i++){
if (hashMove==moveList[i]){
moveList[i]=0;
break;
}
}
if (zeroFirstKiller)
for(i=0;i<num;i++){
if (killer[0][ply]==moveList[i]){
moveList[i]=0;
break;
}
}
if (zeroSecondKiller)
for(i=0;i<num;i++){
if (killer[1][ply]==moveList[i]){
moveList[i]=0;
break;
}
}
Tmove hmove;
int historyHigh,numToZero;
int historyScans=3;
if (num<historyScans)
historyScans=num;
for(int j=0;j<historyScans;j++){
hmove=0;
historyHigh=-1;
for(i=0;i<num;i++){
if (history[FROM(moveList[i])][TO(moveList[i])]>historyHigh &&
moveList[i]!=0){
historyHigh=history[FROM(moveList[i])][TO(moveList[i])];
hmove=moveList[i];
numToZero=i;
}
}
if (hmove!=0){
*hold=*brd;
makeMove(hold,hmove);
if (!check(hold,side)){
value=-computerRecurse(hold,ply+1,depth-1,-side,-b,-a);
if (value>a){
if (value>=b){
setHash(brd,value,depth,LOWER,hmove,side);
if (killer[0][ply]!=hmove){
killer[1][ply]=killer[0][ply];
killer[0][ply]=hmove;
}
free(moveList);
free(hold);
return value;
}
a=value;
pv[ply][ply]=hmove;
for(i=ply+1;i<pvLength[ply+1];i++)
pv[ply][i]=pv[ply+1][i];
pvLength[ply]=pvLength[ply+1];
}
}
moveList[numToZero]=0;
}
}
while (num>0){
num--;
if (moveList[num]!=0){
*hold=*brd;
makeMove(hold,moveList[num]);
if (!check(hold,side)){
value=-computerRecurse(hold,ply+1,depth-1,-side,-b,-a);
if (value>a){
if (value>=b){
setHash(brd,value,depth,LOWER,moveList[num],side);
history[FROM(moveList[num])][TO(moveList[num])]+=depth;
if (killer[0][ply]!=moveList[num]){
killer[1][ply]=killer[0][ply];
killer[0][ply]=moveList[num];
}
free(moveList);
free(hold);
return value;
}
a=value;
pv[ply][ply]=moveList[num];
for(i=ply+1;i<pvLength[ply+1];i++)
pv[ply][i]=pv[ply+1][i];
pvLength[ply]=pvLength[ply+1];
}
}
}
}
free(moveList);
free(hold);
if (value==-2000000){
if (check(brd,side)){
setHash(brd,-1000000+ply,depth,EXACT,0,side);
return (-1000000+ply);
}
setHash(brd,brd->score*side,depth,UPPER,0,side);
return brd->score*side;
}
if (a==oldA)
setHash(brd,a,depth,UPPER,0,side);
else
setHash(brd,a,depth,EXACT,pv[ply][ply],side);
return a;
Thats a rather large block
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.