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.
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:
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.