[issue46528] Simplify the VM's stack manipulations

Ken Jin report at bugs.python.org
Fri Jan 28 06:00:26 EST 2022


Ken Jin <kenjin4096 at gmail.com> added the comment:

> IIRC, Carl got a lot of benefit out of reordering the opcodes in the main loop to put the most common ones at the top.  I don't know if that is still relevant or whether computed gotos, when enabled, change that calculus.

AFAIK, on nix systems with PGO, the order doesn't matter. Brandt did some interesting research on this earlier https://github.com/faster-cpython/ideas/issues/96.

On Windows, it might be a different story. There are reports of up to 5% speedups in pyperformance just by moving LOAD_FAST and LOAD_GLOBAL out of the loop (to the top).  See the last few messages in https://bugs.python.org/issue45116. I've heard from some people that MSVC's PGO doesn't deal with gigantic switch-case statements very well, though I can't confirm the veracity of that info.

----------
nosy: +kj

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46528>
_______________________________________


More information about the Python-bugs-list mailing list