diff options
| author | Scott Gasch <[email protected]> | 2026-09-05 01:03:28 -0700 |
|---|---|---|
| committer | Scott Gasch <[email protected]> | 2026-09-05 01:03:28 -0700 |
| commit | 6e8645015f73a09f57e592fbf911e66db845b327 (patch) | |
| tree | 25206e1a6e442c1e3456051fab57e0c16ca4384b /src/probe.c | |
| parent | 57502d6e205bc802fc9b89fd1534add5efc4b9ea (diff) | |
Replace Eval()'s piece-dispatch loop with per-type bitboard walks
The old loop walked cNonPawns[color][1..N] (a flat, arbitrarily-
ordered list mixing knight/bishop/rook/queen), doing a mailbox lookup
plus a p&0x4/IS_KNIGHT branch per piece to decide which _Eval*
function to call, then stashing rooks/queens into cDefer/uDefer
arrays to evaluate in a later pass -- a hard-to-predict branch per
piece on top of a mailbox read the callee already redoes for its own
ASSERT.
pos->bbPieces[color][PIECE_TYPE] already exists (incrementally
maintained by move.c) and was simply unused by Eval() until now.
Replaced the whole dispatch with a direct per-type bitboard walk:
knights, then bishops, for side-to-move, then the same for the other
side, then rooks both colors, then queens both colors -- same phase
order as before (load-bearing for bvAttacks accumulation), just
sourced from a bitboard instead of a mixed list + runtime type
dispatch. Retires the cDefer/uDefer bookkeeping entirely -- with each
type its own direct walk, "rooks after minors" is just "do that walk
after this one," nothing to defer.
Verified genuinely behavior-neutral, not just crash-free: built the
pre-change and post-change binaries side by side and diffed
--batch --command output against tests/ecm_ringers.ep_ at sd10. Node
counts, scores, and PVs are byte-for-byte identical across all 11
positions; only wall-clock time and NPS differ, consistently in the
new version's favor (~3-5% faster on this suite, e.g. 1088239 nps ->
1143141 nps, 1560092 -> 1616844). Also verified via the normal
precommit_check.sh gate.
Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01P6g6iF6mD1Hau6nCZCzwYj
Diffstat (limited to 'src/probe.c')
0 files changed, 0 insertions, 0 deletions
