Author: Miguel A. Ballicora
Date: 10:09:06 05/13/02
Go up one level in this thread
On May 13, 2002 at 11:32:36, Daniel Clausen wrote: >On May 13, 2002 at 11:03:51, Miguel A. Ballicora wrote: > >[snip] > >>If I am not confused with the question, a local variable is a waste of memory >>because each call you have to spend the maximum number of moves (256 is >>a safe number). With a global stack "ad hoc" you just use what you need and I >>do not think is much more difficult. > >And how many moves slots would you allocate in that global stack? Probably >something along (MAX_MOVES*MAX_PLIES). The local stack is completely independant >on the MAX_PLIES. It is not independent, it is limited by the size of the stack. If you say that the stack is pretty big, then I can allocate tha same amount of memory out of the stack too. The difference, is that the memory used in the global array will be used more efficiently. >global array: moveListSize = f(MAX_MOVES, MAX_PLIES) >local array : moveListSize = f(MAX_MOVES) > >I prefer the 2nd. My engine won't crash in the 61th ply, because I (wrongly) >assumed it would never reach it. ;) [Hi Murphy] The program with the other approach won't either because It could return eval() at ply 60th as a defensive method of programming (ugly huh? :-)). The difference with the stack version is that you do not know precisely when the stack will run out of memory to have such a defensive procedure. In the other you have control over it. In big machines like today it might not be a problem, I agree, but it certainly is less of a problem with the global approach. In fact, if you decide to move the program one day to a different small machine (palm etc.) it may crash because the stack is smaller. The global procedure is more portable in that respect. You just reduce the size of the array or structure and that's it. Using the stack could give a more readable program, though. Regards, Miguel >>I wonder if this does not hurt cache efficiency (to have lots of "holes" as >>unused memory in the stack, in a highly recursive program). > >That's the only reason _I_ see that 'speaks' for the global version. But even if >it does, I don't think it matters that much NPS-wise. But then, I could be >wrong, since I never measured it. > >Addition: I don't have the actual number, but I also think that 256 moves are >sufficient for MAX_MOVES. But please note that this may be not be true if you >produce pseudolegal moves... > >Sargon
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.