bpo-42115: Add an opcode cache for LOAD_METHOD by pablogsal · Pull Request #23503 · python/cpython

Also this looks pretty similar to my original patch but I didn't compare. Were there any changes to it, I'm just curious?

The idea is the same but this part is simplified:

https://github.com/python/cpython/pull/23503/files#diff-c22186367cbe20233e843261998dc027ae5f1f8c0d2e778abfa454ae74cc59deR3866-R3875

I am also using _PyDict_GetItem_KnownHash to fetch the items for slightly better performance and the rest is just modifications to account for the code changes around.

I am waiting for Inada-san to confirm the benchmarks before landing and adding the NEWS item