New submission from Mark Shannon <m...@hotpy.org>:

Currently the unpacking of starred values in arguments and the right hand side 
of assignments is handled in the interpreter without any help from the compiler.
The layout of arguments and values is visible to the compiler, so the compiler 
should do more of the work.

We can replace the complex bytecodes used in unpacking with simpler more 
focused ones.
Specifically the collection building operations 
BUILD_LIST_UNPACK, BUILD_TUPLE_UNPACK, BUILD_SET_UNPACK and 
BUILD_TUPLE_UNPACK_WITH_CALL
can be replaced with simpler, and self-explanatory operations:
LIST_TO_TUPLE, LIST_EXTEND, SET_UPDATE

In addition, the mapping operations
BUILD_MAP_UNPACK and BUILD_MAP_UNPACK_WITH_CALL
can be replaced with DICT_UPDATE and DICT_MERGE.

DICT_MERGE is like DICT_UPDATE but raises an exception for duplicate keys.

This change would not have much of an effect of performance, as the bytecodes 
listed are relatively rarely used, but shrinking the interpreter is always 
beneficial.

----------
components: Interpreter Core
messages: 359901
nosy: Mark.Shannon
priority: normal
severity: normal
status: open
title: Handle unpacking of */** arguments and rvalues in the compiler
type: performance
versions: Python 3.9

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue39320>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to