bpo-42911: Addition chains by jneb · Pull Request #24206 · python/cpython
I put the code that I can only test with 3.8 here, to see actually works in 3.10.
Short description: speeding up pow(int,int) especially for exponents with between 20 and 500 bits (until the fiveary method kicks in) , but is also saves time outside this range.
Speedup is between 2 % (for very high exponents) to 15% (for exponents of a few hundred bits).
And, I speeded up _Py_bit_length for generic processors just because I could :-)