]> git.sesse.net Git - stockfish/commit
Optimize generate_moves
authorTomasz Sobczyk <tomasz.sobczyk1997@gmail.com>
Sun, 10 Jan 2021 06:30:40 +0000 (03:30 -0300)
committerJoost VandeVondele <Joost.VandeVondele@gmail.com>
Wed, 13 Jan 2021 21:59:54 +0000 (22:59 +0100)
commit6dddcecb09df268d93810a1a38deb116f97672af
tree5045bf2b943bb742cd6ad6c8b085bb99404bb726
parentee3f7b6b6e1a1051b32cedb38ac89b3458ff4ab2
Optimize generate_moves

This change simplifies control flow in the generate_moves function which ensures the compiler doesn't duplicate work due to possibly not resolving pureness of the function calls. Also the biggest change is the removal of the unnecessary condition checking for empty b in a convoluted way. The rationale for removal of this condition is that computing attacks_bb with occupancy is not much more costly than computing pseudo attacks and overall the condition (also being likely unpredictable) is a pessimisation.

This is inspired by previous changes by @BM123499.

Passed STC:
LLR: 2.94 (-2.94,2.94) {-0.25,1.25}
Total: 88040 W: 8172 L: 7931 D: 71937
Ptnml(0-2): 285, 6128, 30957, 6361, 289
https://tests.stockfishchess.org/tests/view/5ffc28386019e097de3ef1c7

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

No functional change.
src/movegen.cpp