1

I am developing a program that analyzes games sequentially, i.e. one game after another.

Below are the parameters.


Engine: Stockfish 10

Threads: 2

Hash Table: 4000

Depth: 30


My question is about when to use the command: "setoption name Clear Hash."

Should it be used after each position is analysed? This means that each position would have a "fresh" hash at the beginning of the analysis.

Or should it be used after each game is analysed? What are the differences?

3

If your goal is to get the highest quality of analysis, then the short answer is "never".

The reason is that if you analyze similar positions within a game, then the existing hash table entries can still be valuable for move ordering and evaluation, because the same positions might be encountered somewhere in the search tree again.

If you switch to a new game, then the hash should be cleared, but in that case Stockfish already does it implicitly when it receives the ucinewgame command. In fact, in Stockfish ucinewgame does exactly the same as setoption name Clear Hash.

1

A hash table is used to store evaluations/information for a position, so that evaluating it later is either instantaneous or much more efficient. If you let your engine think on a certain position for a while, the positions it thinks of when searching ahead are stored in its table. This is useful when you make a move on the current position and reach a new position for Stockfish to analyse (since its already "seen" it in its analysis).

So when analyzing a certain game, do not reset the hash table. You could reset it when moving on to a new game though, especially if the new game starts off with different opening moves than the previous game. This is because most/all of the positions analysed in the previous game will be irrelevant, and will just take up space in the hash table.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.