Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance and testing improvements #6

Merged
merged 13 commits into from
Apr 13, 2024
Merged

Conversation

pdil
Copy link
Member

@pdil pdil commented Apr 7, 2024

Changes

  • Added extra unit tests to get code coverage close to 100%.
  • Added Board performance tests.
  • Fixed source code indentation.
  • Added ability to print Board and Position.
  • Implemented Board using bitboards, see performance improvements below.

Performance Improvements

The Bitboard implementation has resulted in a ~280x improvement† in computation time when simulating a full game (85 ply) played with a Board object, including initialization, at the cost of a ~40% increase in memory usage.

Results Comparison

Based on testBoardPerformance() performance test before and after Bitboard implementation.

Metric Before After % Change
CPU Time (s) 5.299 0.019 🟢 99.6% ↘
CPU Cycles (kC) 13177592.595 46831.659 🟢 99.6% ↘
CPU Instructions (kI) 63112699.927 224032.835 🟢 99.6% ↘
Peak Memory (kB) 11002.291 15373.645 🔴 39.7% ↗

Xcode Output

Before After
before - ck performance after - ck performance

† Tested on M1 Pro 8-core CPU (2021 14" Macbook Pro)

@pdil pdil added the enhancement A suggestion or feature that improves existing functionality label Apr 7, 2024
@pdil pdil self-assigned this Apr 7, 2024
@pdil pdil marked this pull request as ready for review April 13, 2024 21:44
@pdil pdil merged commit 8e51544 into master Apr 13, 2024
3 checks passed
@pdil pdil deleted the feature/performance-improvements branch April 13, 2024 21:48
@pdil pdil added tech Technical changes or requests not related to user functionality and removed enhancement A suggestion or feature that improves existing functionality labels Apr 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tech Technical changes or requests not related to user functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant