Skip to content

Optimize gives_check for simple variants#18

Open
Belzedar94 wants to merge 2 commits intomasterfrom
codex/optimize-codebase-for-performance-improvements
Open

Optimize gives_check for simple variants#18
Belzedar94 wants to merge 2 commits intomasterfrom
codex/optimize-codebase-for-performance-improvements

Conversation

@Belzedar94
Copy link
Copy Markdown
Owner

Summary

  • add a fastCheckDetection flag to Variant that identifies simple rule sets without drops, gating, or other special mechanics
  • use the new flag to execute a streamlined Position::gives_check path for normal, promotion, en passant, and castling moves

Testing

  • printf "setoption name UCI_Variant value chess position startpos go perft 5 quit " | ./stockfish
  • printf "setoption name UCI_Variant value chess position fen r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq - go perft 5 quit " | ./stockfish
  • ./stockfish bench

https://chatgpt.com/codex/tasks/task_e_68d1202c875083228d2c6402a0f71365

@Belzedar94
Copy link
Copy Markdown
Owner Author

Standard chess bench:

Pre-patch:
Total time (ms) : 10745
Nodes searched : 6180480
Nodes/second : 575195

===========================

Post-patch:
Total time (ms) : 9860
Nodes searched : 6137642
Nodes/second : 622478

@Belzedar94
Copy link
Copy Markdown
Owner Author

Second speed-up bench comparison:

Pre-patch:
Total time (ms) : 11071
Nodes searched : 6137642
Nodes/second : 554389

===========================

Post-patch:
Total time (ms) : 10121
Nodes searched : 6137642
Nodes/second : 606426

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant