New submission from Xavier Morel <xavier.mo...@masklinn.net>:

Following bpo-39320 the highly specialised bytecode for vararg calls were 
replaced by simpler ones, but there seems to be at least one area where the 
generated bytecode regressed for possibly no reason?

In Python 3.8, foo(**var) compiles to:

0 LOAD_GLOBAL              0 (foo)
2 BUILD_TUPLE              0
4 LOAD_FAST                2 (var)
6 CALL_FUNCTION_EX         1

In Python 3.9, it compiles to:

0 LOAD_GLOBAL              0 (foo)
2 BUILD_TUPLE              0
4 BUILD_MAP                0
6 LOAD_FAST                2 (var)
8 DICT_MERGE               1
0 CALL_FUNCTION_EX         1

The PR 18141 does not seem to change the implementation of CALL_FUNCTION_EX so 
I would expect that if it was fine with taking the `var` arbitrary mapping 
before it stil is now, and the extra two opcodes (and creation of a dict) is 
unnecessary?

----------
messages: 378613
nosy: Mark.Shannon, xmorel
priority: normal
severity: normal
status: open
title: Seemingly unnecessary complexification of foo(**kw)
versions: Python 3.9

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

Reply via email to