Author: Ron Murawski
Date: 17:19:43 12/10/02
Go up one level in this thread
On December 10, 2002 at 18:51:43, Federico Corigliano wrote: >Hello > >Mi chess program uses a structure for the hash entry of 24 bytes. If I need to >use 8 MB for the hash table, then I have two options: >- Set the number of entries in power of two (262144 * 24 = 6291456 bytes) >- Set the number of entries: (8*1024576)/24 = aprox. 340000 entries > >The second fill more the space asked, but I read that hashtables in power of two >are more efficient. > >What do you recommend me? > >Federico Corigliano > >PS: Sorry but my poor english Hi Federico, I have just finished extensive play testing of exactly this question. I found that power-of-two sizes are not best unless the requested hash size just happens to result in a power-of-two number of entries. In this case a simple 'and' to determine an entry slot wins over the slower 'mod' method, but not by much. At other hash sizes, the number of entries between the two methods differs by up to a factor of 2 (just less than 2, actually). I found that the larger the hash is set (causing more entries), the stronger my engine plays -- the speedup from 'and' was totally lost due to the lesser amount of entries. The entry size ratio of the two methods averages out to about 1.5 and, at this difference, using my engine, the 'mod' method is the winner by a small but measurable margin (about 30 Elo). I also found that it seems best to have a prime number of entries in the table, but this was not tested as thoroughly -- This opinion is based on measurements of time-to-solution for several test positions. Best regards, Ron
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.