Author: Colin Frayn
Date: 01:12:49 03/28/00
Go up one level in this thread
On March 27, 2000 at 23:02:35, Paul Byrne wrote:
>I just ran into an interesting problem. I've been cleaning up my code lately
>and just discovered that my MoveList class still has asserts in it. MoveList
>is basically just an array of moves and a counter for now, and adding a Move
>is done by
> void Add(Move mv) { assert(num<MAX); moves[num++]=mv; }
>It has now played over 8000 games, so my choice of MAX seems to be pretty
>safe, and I removed the assert.
I always leave all mine in the code just in case. You never know when you might
want to alter something later on and then you'll wonder why your program keeps
crashing spuriously.
>The resulting program is more than 10% SLOWER, which was rather unexpected.
>The only place Add is used is the move generator, so the move generator must
>be running much slower to hurt the entire program that much.
>Anyone have any idea what is happening here?
If you put an assert in, often the compiler is able to optimise the code knowing
certain conditions on the input parameters to each function, loop etc....
I've had a few wierd problems like that in that past. I expect Dann knows a bit
about this kind of thing.
Cheers,
Col
Cheers,
Col
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.