KYLChiu / sporkfish

Chess engine in Python
MIT License
5 stars 0 forks source link

[Feature] Consider moving init of move ordering weights into class level #127

Open KYLChiu opened 6 months ago

KYLChiu commented 6 months ago
          @kwngggg Good point...if we take @KYLChiu's suggestion then the design is going to look a bit odd - essentially we would no longer need the `CompositeHeuristicConfig` class anymore.

I am personally in favour of your (Kev's) original design (using CompositeHeuristicConfig) - it is more consistent with other parts of the code, ecstatically more pleasing, and easier to read. Of course, if it turns out there is a significant perf hit, then we have no choice...

@KYLChiu you really think a small constructor with 2 lines of code (declaration and assignment) would make a significant difference?

_Originally posted by @ccjeremylo in https://github.com/KYLChiu/sporkfish/pull/126#discussion_r1508210005_

KYLChiu commented 6 months ago
ncalls  tottime  percall  cumtime  percall filename:lineno(function)
69916    0.153    0.000    0.285    0.000 composite_heuristic.py:14(_init_)

With the current design we will have 1s loss on my machine for 10^6 calls, which I would argue is not needed given this could potentially be an easy fix.