Answers.Body: <p>Yes, Stockfish will go deeper if the hash is large enough to make a difference. The default value is 16 MB which is not a lot. After increasing the hash you likely see that the second time the search depth reached after 500 ms is higher than the first time you let Stockfish calculate.</p>
  <pre><code>setoption name Hash value 256
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-01-04T11:39:05.370Z
Answers.Text: Thank you for your answer. By now, I also observed that when I called the Stockfish engine multiple times on the same position, the analysis depth increased - meaning Stockfish remembered earlier analysis results and built on those to improve the analysis.
Answers.UserDisplayName: Mercutio1243
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-12-20T13:46:40.403Z
Answers.LastActivityDate: 2023-12-20T13:46:40.403Z
Answers.UserDisplayName: Gecko
Answers.Body: <p>One UCI session you mean? To make reproducible experiments or test above, you can compare/contrast multiple calls, by using the UCI purge hash.</p>
  <p>&quot;setoption name Clear Hash&quot;</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-12-22T03:55:44.670Z
Answers.LastActivityDate: 2023-12-22T03:55:44.670Z
Answers.UserDisplayName: dbdb
Body: <p>Let's say I call Stockfish via</p>
  <pre><code>&gt; position fen rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1
  &gt;'go movetime 500';
  </code></pre>
  <p>Now, after Stockfish has finished the analysis, what happens if I call stockfish again with the same position?</p>
  <pre><code>&gt; position fen rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1
  &gt; go movetime 500
  </code></pre>
  <p>Will Stockfish build on the already performed analysis and simply go deeper? Or will it start the analysis anew?</p>
  
Tags: <engines>
Title: Does chess engine Stockfish remember already performed calculations within one session?
ThreadText: # Does chess engine Stockfish remember already performed calculations within one session?
  
  (Asked by: username_0 on 2023-12-20)
  
  Let's say I call Stockfish via
  > position fen rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1
  >'go movetime 500';
  
  Now, after Stockfish has finished the analysis, what happens if I call stockfish again with the same position?
  > position fen rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1
  > go movetime 500
  
  Will Stockfish build on the already performed analysis and simply go deeper? Or will it start the analysis anew?
  
  **Tags:** engines
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2023-12-20. Score: 5 | Accepted answer
  
  Yes, Stockfish will go deeper if the hash is large enough to make a difference. The default value is 16 MB which is not a lot. After increasing the hash you likely see that the second time the search depth reached after 500 ms is higher than the first time you let Stockfish calculate.
  setoption name Hash value 256
  
  > **Comments:**
  > **username_0**: Thank you for your answer. By now, I also observed that when I called the Stockfish engine multiple times on the same position, the analysis depth increased - meaning Stockfish remembered earlier analysis results and built on those to improve the analysis.  
  
  ---
  
  ### Answer by username_2 on 2023-12-22. Score: 2
  
  One UCI session you mean? To make reproducible experiments or test above, you can compare/contrast multiple calls, by using the UCI purge hash.
  
  "setoption name Clear Hash"
  
  
  ---
  
  