I am writing a chess program in Python and I am using python-chess to represent the board and move the generation, etc. This is generally very good and has very useful features.
However, since it is in pure Python, it is now the bottleneck of my AI. Python's long-running integer and its bitwise operations are widely used in a module, for example
x = b & -b
b ^= x
if not x & 0xffffffff:
x >>= 32
r |= 32
Is there a way to speed up this kind of operation in Python, with some other module? Is it possible without rewriting in C or Fortran? I tried the numba package, but it doesn't seem to be able to compile python long int.
Many thanks.
jf328 source
share