◐ Shell
clean mode source ↗

bpo-46329: Avoid `PUSH_NULL` when followed by `LOAD_GLOBAL` by markshannon · Pull Request #31933 · python/cpython

Uses the low bit of LOAD_GLOBAL's oparg to indicate whether it should push a NULL first.

len(alist)

now compiles to

LOAD_GLOBAL              1 (NULL + len)
LOAD_FAST                0 (alist)
PRECALL                  1
CALL                     1

This reduces the total number of VM instructions executed by ~2%.

The benchmark results show an unlikely 3% speedup, probably just one of those random build variations.

https://bugs.python.org/issue46329