kalebburnham / Majikthise-Python

0 stars 0 forks source link

Store piece boards in a piece-indexed structure to reduce branching. #21

Open kalebburnham opened 1 year ago

kalebburnham commented 1 year ago

The putPiece and removePiece are running on the order of 100 nanoseconds per call due to a high branching factor. This could be reduced if the piece Bitboards are stored in a dictionary indexed on piece type.

From the profiler: ncalls tottime percall cumtime percall filename:lineno(function) 31349661 28.726 0.000 28.726 0.000 board.py:312(removePiece) 31349661 35.541 0.000 71.748 0.000 board.py:353(putPiece)