Any formula or way to figure out optimal hash size?

Discussion of anything and everything relating to chess playing software and machines.

Moderators: hgm, Rebel, chrisw

jmartus
Posts: 256
Joined: Sun May 16, 2010 2:50 am

Any formula or way to figure out optimal hash size?

Post by jmartus »

Is there any way to figure out the best hash table size or does it not really matter anyways?
kranium
Posts: 2129
Joined: Thu May 29, 2008 10:43 am

Re: Any formula or way to figure out optimal hash size?

Post by kranium »

time per move (secs) * nodes per sec * hash entry size (in bytes)

for ex:

if time per move = 60 sec, nps = 700,000, and hash table entry = 16 bytes
(16 bytes being somewhat typical but can vary)
then:
60 secs x 700,000 nps x 16 bytes = 640 MB

to make this calculation you have to determine the engine's NPS on the hardware being used (run bench with same # of threads to be used, or observe output from command line).
that is the amount of RAM that will be used in a typical move for that time control
adding extra RAM might be useful, but a full hash table is not really a big problem as most modern hash algorithms age entries for replacement

My advice: give modern engines a lot of workspace (within reason), and as much as you can afford for analysis
and don't worry...