[issue42115] Caching infrastructure for the evaluation loop: specialised opcodes

Pablo Galindo Salgado report at bugs.python.org
Wed Oct 21 23:24:42 EDT 2020


Pablo Galindo Salgado <pablogsal at gmail.com> added the comment:

To clarify what I mean with:

> - We could also do the same for operations like "some_container[]" if the container is some builtin. We can substitute/specialize the opcode for someone that directly uses built-in operations instead of the generic BINARY_SUBSCR.

If a given function has a BINARY_SUBSCR opcode and when executing it a given number of times we see that the object to get the subscript is always a list, we change the BINARY_SUBSCR to BINARY_SUBSCR_FOR_LISTS and it that opcode we do a quick check for PyList_CheckExact and if is correct we call "Objects/listobject.c:list_subscript" directly and if is false we put back a BINARY_SUBSCR.

----------

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


More information about the Python-bugs-list mailing list