Author: Robert Hyatt
Date: 08:55:20 01/20/04
Go up one level in this thread
On January 20, 2004 at 04:32:40, Sune Fischer wrote: >On January 19, 2004 at 21:52:53, Robert Hyatt wrote: > >>Here is what I do. Dirt-simple. No extra work: > >There is also the termination issue. > >>Finally I copy the best move at the _current ply_ into the PV for the >>previous ply. To count the work done, if doing a 10 ply search with no >>extensions, at ply=10 all I do is store the current move at ply=9 in path[10]. >>When I finish 9, I copy that one word back to ply 8 and then stuff my best >>move in at path[9]. >> >>By the time I get to the root I have copied 10+9+8+7+...+1 words total. I >>had been intending to simplify this a bit further, but it has no cost and I >>have not done anything else. > >That is a very optimistic estimate, you are assuming perfect move ordering. >I'm quite sure there will be cases where you do 100 times that amount of work. OK. Multiply the above by 100x and turn that into times. It takes how long to copy a complete cache line from memory to cache and back? That is 32 words which is longer than _most_ PVs. Do that 100 times you can't even measure it over the rest of the search expense. :) > >The fundamental principle in chess programming is never to do any work that is >not needed. >That's why I think it is a bit silly to update a PV a few hundred times (in >particular in qsearch) and then only print it out the last one. > >If you need the pv for search related things I can understand, but if you only >want it to look at it then it is nothing more than eye-candy. Sorry, but we disagree. A chess engine has more than one function. If all it did was play chess, then I'd get rid of the PV myself although I might change my mind based on move ordering. IE at the end of an iteration I stuff the PV into the hash to make sure there are no "fishy" moves left there, and not doing that will impact the search space a bit. But a chess engine does other things. IE analyze positions and give scores and PVs for the moves. Who would want an annotated game that just suggested a move and score, with no indication of why the move played was bad or the move suggested was good? And, again, what about debugging? > >> Using a special "sentinel" isn't quite as clean >>for me as I have a pathl value that tells me how many moves are in the PV, >>so that I can tell memcpy() how much stuff needs copying. >> >>I could copy the entire path each time I back it up, but that is extra traffic >>that is not needed. > >I wonder if memcpy is faster for such tiny amounts, my impression was that >memcpy is best with large chunks of data. > >-S. There I don't know. Since I wrote it this way, I suspect it is faster, as I almost always benchmark things and choose the fastest... But I will try it again to see...
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.