Skip to content

Reuse computed ray bitboard in update_piece_threats#6899

Open
zungur wants to merge 1 commit into
official-stockfish:masterfrom
zungur:cleanups-perf
Open

Reuse computed ray bitboard in update_piece_threats#6899
zungur wants to merge 1 commit into
official-stockfish:masterfrom
zungur:cleanups-perf

Conversation

@zungur

@zungur zungur commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Reuse the already-computed ray instead of calling ray_pass_bb a second time with identical arguments.

No functional change

Reuse the already-computed ray instead of calling ray_pass_bb a second
time with identical arguments.

No functional change
@github-actions

Copy link
Copy Markdown

(execution 27386701076 / attempt 1)

@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9c9fb680-eb4a-43c5-a6b9-24dceb6352b1

📥 Commits

Reviewing files that changed from the base of the PR and between 86f1df7 and f8e8424.

📒 Files selected for processing (1)
  • src/position.cpp

📝 Walkthrough

Walkthrough

This pull request optimizes the Position::update_piece_threats function in src/position.cpp. The change modifies the filtering condition inside the slider-processing loop that checks for discovered slider threats. Instead of recalculating the ray bitboard by calling ray_pass_bb(sliderSq, s), the condition now reuses the ray variable that was already computed earlier in the loop. This eliminates a redundant bitboard calculation while maintaining identical logic.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

1 participant