bsamseth / Goldfish

Goldfish - Stockfish's very distant and not so bright cousin - a UCI chess engine
MIT License
7 stars 2 forks source link

Refactor code base #15

Closed bsamseth closed 6 years ago

bsamseth commented 6 years ago

The code was visibly written by a Java programmer, so a couple of things I want different.

This is not necessarily the perfect setup, so it might change slightly later, but it is definitively more the way I want it to be.

Generally, the changes are to use enums rather than ints for everything. The changes should in principle not be a functional change. However, preliminary benchmarking shows a significant speed-up:

master
===========================
Total time (ms) : 48235
Nodes searched  : 32098327
Nodes/second    : 665457

refactor
===========================
Total time (ms) : 32927
Nodes searched  : 32098327
Nodes/second    : 974833

These numbers are to be taken with a large grain of salt, as they differ significantly between runs. On that note, a proper benchmarking comparison script should be made.

However, the speed-up is also quite possible, as using the enums might allow the compiler to pack things more efficiently, compared to everything being ints. Who knows.