Author: martin fierz
Date: 15:58:58 02/07/02
aloha,
i am just writing a program to generate endgame databases and wanted to check my
functions, so i did the following:
for a whole database i do (details suppressed)
for(i=0;i<dbsize;i++)
{
indextoposition(i,&p);
positiontoindex(&p, &index);
if(i!=index)
printf("\nerror!");
}
and ran the profiler on this. it says:
Funct. funct.+subfunct. number of calls function
time % time %
------------------------------------------------------------------
1501.647 37.3 3178.206 78.8 201272 _positiontoindex (index.obj)
974.731 24.2 974.731 24.2 1124592 _bitcount (bool.obj)
497.789 12.3 497.789 12.3 598576 _LSB (bool.obj)
401.534 10.0 401.534 10.0 204056 _indextoposition (index.obj)
371.568 9.2 3951.488 98.0 35 _buildsubdb (dbmain.obj)
204.039 5.1 204.039 5.1 236520 _MSB (bool.obj)
71.608 1.8 71.608 1.8 1 _initdatabases (dbmain.obj)
7.125 0.2 7.125 0.2 1 _initbool (bool.obj)
0.744 0.0 4030.994 100.0 1 _main (dbmain.obj)
0.180 0.0 0.180 0.0 161 _getdatabasesize (dbmain.obj)
0.028 0.0 3951.517 98.0 5 _builddb (dbmain.obj)
so, i guessed, positiontoindex is 8 times slower than indextoposition (same
number of calls, 8x more time needed). that's bad, because both the generator
and the program themselves will both need a fast positiontoindex function. so i
decided to test again and did this without profiling, but with a time
measurement for a certain database:
for(i=0;i<dbsize;i++)
{
indextoposition(i,&p);
positiontoindex(&p, &index);
if(i!=index)
printf("\nerror!");
}
result: 17.5 seconds. then i did this
for(i=0;i<dbsize;i++)
{
indextoposition(i,&p);
//positiontoindex(&p, &index);
//if(i!=index)
// printf("\nerror!");
}
result: 13.2 seconds.
i don't get it - this means that indextoposition is 3 times slower than
positiontoindex. that's a factor of **** 24 **** different than what the
profiler tells me. i can understand that profiling is not easy, and that
measurements may not be accurate. but a factor 24? any suggestions on what is
wrong here?
aloha
martin
PS i was using visual C++ 6.0 professional.
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.