Skip to content

Conversation

@luccabb
Copy link
Owner

@luccabb luccabb commented Jan 20, 2026

Summary

  • Open Syzygy tablebase once in __init__ instead of on every eval_board call
  • Add close() method for proper resource cleanup
  • Use pre-opened tablebase handle for all probes

Details

Previously, the tablebase was opened/closed on every call to eval_board() when
checking endgame positions:

# Before (slow)
with chess.syzygy.open_tablebase(path) as tablebase:
    tablebase.probe_dtz(board)

Now we open once and reuse:

# After (fast)
self.tablebase.probe_dtz(board)

This eliminates significant overhead in endgame positions where many evaluations
may hit the tablebase.

Test plan

  • All 64 unit tests pass
  • Tablebase functionality preserved

🤖 Generated with Claude Code

@luccabb luccabb force-pushed the feature/transposition-table-bounds branch from bb2ac9f to f833c45 Compare January 21, 2026 06:40
@luccabb luccabb force-pushed the feature/syzygy-tablebase-init branch from 82526b0 to 5f456a9 Compare January 21, 2026 06:40
@luccabb luccabb force-pushed the feature/transposition-table-bounds branch from f833c45 to 7a14812 Compare January 21, 2026 06:43
@luccabb luccabb force-pushed the feature/syzygy-tablebase-init branch from 5f456a9 to edb7941 Compare January 21, 2026 06:43
@luccabb luccabb changed the base branch from feature/transposition-table-bounds to master January 21, 2026 07:00
@luccabb luccabb changed the title [3/9] Open Syzygy tablebase once at initialization Open Syzygy tablebase once at initialization Jan 21, 2026
@luccabb luccabb force-pushed the feature/syzygy-tablebase-init branch from 74b7d0b to d9f287a Compare January 21, 2026 07:17
Instead of opening the tablebase file on every eval_board() call,
open it once in __init__ and reuse the connection. This avoids
repeated file I/O overhead during search.

- Add tablebase instance variable initialized in __init__
- Add close() method for cleanup
- Update eval_board to use pre-opened tablebase

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@luccabb luccabb force-pushed the feature/syzygy-tablebase-init branch from d9f287a to d0d55da Compare January 21, 2026 07:22
@luccabb luccabb merged commit cb7f635 into master Jan 21, 2026
10 checks passed
@luccabb luccabb deleted the feature/syzygy-tablebase-init branch January 21, 2026 07:25
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