]> git.sesse.net Git - stockfish/commitdiff
Compact position structures
authorGuy Vreuls <guyvreuls@gmail.com>
Fri, 21 May 2021 18:22:29 +0000 (20:22 +0200)
committerStéphane Nicolet <cassio@free.fr>
Fri, 21 May 2021 22:26:00 +0000 (00:26 +0200)
Reorder the structures data members in position.h to reduce padding.

Passed STC:
https://tests.stockfishchess.org/tests/view/60a8011fce8ea25a3ef04069
LLR: 2.94 (-2.94,2.94) <-0.50,2.50>
Total: 14120 W: 1214 L: 1067 D: 11839
Ptnml(0-2): 26, 857, 5161, 976, 40

---

Also tested for speed locally by Joost:

Result of  50 runs
==================
base (./stockfish.master       ) =    2254919  +/- 4439
test (./stockfish.patch        ) =    2274003  +/- 5278
diff                             =     +19084  +/- 6386
==================
speedup        = +0.0085
P(speedup > 0) =  1.0000

---

closes https://github.com/official-stockfish/Stockfish/pull/3488

No functional change.

src/position.h

index c226373b1f7cd3d1125b8434c4ad78e699e4e98d..e6b072bc82dd2dda20d9b199a2282de0b911ba73 100644 (file)
@@ -51,11 +51,11 @@ struct StateInfo {
   // Not copied when making a move (will be recomputed anyhow)
   Key        key;
   Bitboard   checkersBB;
-  Piece      capturedPiece;
   StateInfo* previous;
   Bitboard   blockersForKing[COLOR_NB];
   Bitboard   pinners[COLOR_NB];
   Bitboard   checkSquares[PIECE_TYPE_NB];
+  Piece      capturedPiece;
   int        repetition;
 
   // Used by NNUE
@@ -192,11 +192,11 @@ private:
   int castlingRightsMask[SQUARE_NB];
   Square castlingRookSquare[CASTLING_RIGHT_NB];
   Bitboard castlingPath[CASTLING_RIGHT_NB];
+  Thread* thisThread;
+  StateInfo* st;
   int gamePly;
   Color sideToMove;
   Score psq;
-  Thread* thisThread;
-  StateInfo* st;
   bool chess960;
 };