Author: Daniel Clausen
Date: 02:26:47 07/26/02
Go up one level in this thread
On July 26, 2002 at 04:44:16, Leen Ammeraal wrote: >On July 26, 2002 at 03:43:53, Russell Reagan wrote: > >>I was curious if anyone was using STL in their engine, or if that is a bad >>idea. For example, I considered using an std::vector to store my legal moves >>in during the search. After thinking about this, I realized it probably >>wasn't a good idea since vector allocates memory dynamically when calling >>push_back() (if the vector is full). >I did not even try vectors to store moves because this >seemed inefficient to me. >Remember, the memory allocated for a vector is usually >much more than is initially needed, as the 'capacity' >function shows. This is done to avoid immediate >reallocation each time the vector grows. Well, if you use a fixed array (say int moves[256]) you also waste a lot of space in most cases. If you're that concerned about wasted memory, the best you can do is using Bobs approach in Crafty: using a big global array and use indices for the start/end of the movelist on each ply. But honestly: If people are that concerned about wasted space and loss of speed in such cases, I would skip the OOP approach and do it the classic way. You don't gain a whole lot if you only do it 'halfway'.. Of course that's just my opinion.. (I also only do it halfway (if at all) in Sinan, but I want to change that - if I have time in the next 10 years, that is) 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.