From f233ca1af4d36ded8ce924131f42bc4d0093ec6e Mon Sep 17 00:00:00 2001 From: Guy Vreuls Date: Fri, 21 May 2021 20:22:29 +0200 Subject: [PATCH] Compact position structures 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 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/position.h b/src/position.h index c226373b..e6b072bc 100644 --- a/src/position.h +++ b/src/position.h @@ -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; }; -- 2.39.2