Skip to content

Conversation

@Sopel97
Copy link
Member

@Sopel97 Sopel97 commented Jan 11, 2021

This is inspired by previous changes by @BM123499.

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.

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

The test was performed against BM's branch that was merged into master. the only change for this PR is that I added [[maybe_unused]] as making sure the variable is not defined in some cases is not trivial.

@Sopel97
Copy link
Member Author

Sopel97 commented Jan 12, 2021

We could also take this as a better way to write the same
https://github.com/BM123499/Stockfish/blob/12727444c4fb572d74413c064a6acf04998bc670/src/movegen.cpp#L185-L193

@BM123499
Copy link
Contributor

@Sopel97 to be honest, I don't know. I don't know what is important and what isn't when it comes to compiler optimization. And results shows no difference. We should focus on readability (and being sincere, I don't like mine very much). Great job, anyway.

@vondele vondele added the to be merged Will be merged shortly label Jan 13, 2021
@vondele vondele closed this in 6dddcec Jan 13, 2021
joergoster pushed a commit to joergoster/Stockfish-old that referenced this pull request Jan 14, 2021
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 official-stockfish/Stockfish#3300

No functional change.
BM123499 pushed a commit to BM123499/Stockfish that referenced this pull request Feb 22, 2021
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 official-stockfish#3300

No functional change.
@BM123499 BM123499 mentioned this pull request Mar 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

to be merged Will be merged shortly

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants