kalebburnham / Majikthise-Python

0 stars 0 forks source link

Rewrite calls to WHITE_BOARD and BLACK_BOARD #20

Open kalebburnham opened 1 year ago

kalebburnham commented 1 year ago

While traversing 6 plies, these functions took approximately 21 and 13 seconds respectively. This information can be cached in the board object to increase speed.

kalebburnham commented 1 year ago

I rewrote the calls, but now we have this function in the profiler. It's not too great of an improvement, shaved off about 10 seconds.

ncalls tottime percall cumtime percall filename:lineno(function) 31017710 24.889 0.000 24.889 0.000 board.py:404(updateColorBoards)

However, both color boards get updated every time. Another possibility is to index the color boards in a dictionary or tuple indexed on the color. Then only one of the boards is updated as needed and branching is avoided.