Skip to content

Conversation

@protonspring
Copy link

This is a non-functional speed-up. Master has to access SquareBB twice while this patch determines opposite_colors just using the values of the squares. It doesn't seem to change the overall speed of bench, but calling opposite_colors(...) 10Million times:

master: 39.4 seconds
patch: 11.4 seconds.

The only data point I have (other than my own tests), is a quite old failed STC test:
LLR: -2.93 (-2.94,2.94) [-1.50,4.50]
Total: 24308 W: 5331 L: 5330 D: 13647
Ptnml(0-2): 315, 2577, 6326, 2623, 289
http://tests.stockfishchess.org/tests/view/5e010256c13ac2425c4a9a67

@protonspring
Copy link
Author

It would be more code, this would be much clearer with a square_color() method. Then opposite_colors would just check it square_color(s1) != square_color(s2);

@protonspring
Copy link
Author

This could also be added now that we have a method that quickly determines square color:

http://tests.stockfishchess.org/tests/view/5e28b69ec3b97aa0d75bc2aa

@snicolet snicolet closed this in f3c83ed Jan 23, 2020
@snicolet
Copy link
Member

Merged via f3c83ed, thanks!

@ghost
Copy link

ghost commented Apr 2, 2020

@protonspring Sorry to necro an older patch, but I was looking at the current KXK endgame and I came across these lines:
|| ( (pos.pieces(strongSide, BISHOP) & ~DarkSquares)
&& (pos.pieces(strongSide, BISHOP) & DarkSquares)))
Do you think this would be somewhere worth using opposite_colors instead?

@protonspring
Copy link
Author

protonspring commented Apr 2, 2020 via email

@ghost
Copy link

ghost commented Apr 2, 2020

@protonspring Cool that makes sense, I forgot that we would have to first check for the existence of both bishops before we could call opposite_colors. Thanks.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants