New submission from Serhiy Storchaka:

BUILD_MAP, BUILD_MAP_UNPACK and BUILD_MAP_UNPACK_WITH_CALL need pushing 
key-value pairs on the stack. If keys and values are not constant, this is 
correct order of evaluating them. But if keys are constant (very common case), 
the order of pushing them doesn't affect semantic. We can pack them in constant 
tuple and push on the stack by one instruction.

I think there would be a benefit from adding new opcodes that take a sequence 
of values and a tuple of keys instead of a sequence of key-value pairs.

New MAKE_FUNCTION (issue27095) and new CALL_FUNCTION (issue yet not opened) 
could have a benefit.

----------
components: Interpreter Core
messages: 266511
nosy: Demur Rumed, serhiy.storchaka
priority: normal
severity: normal
stage: needs patch
status: open
title: Opcode for creating dict with constant keys
type: enhancement
versions: Python 3.6

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

Reply via email to