mirror of
https://github.com/python/cpython.git
synced 2025-08-01 07:33:08 +00:00
Speed-up dictionary constructor by about 10%.
New opcode, STORE_MAP saves the compiler from awkward stack manipulations and specializes for dicts using PyDict_SetItem instead of PyObject_SetItem. Old disassembly: 0 BUILD_MAP 0 3 DUP_TOP 4 LOAD_CONST 1 (1) 7 ROT_TWO 8 LOAD_CONST 2 ('x') 11 STORE_SUBSCR 12 DUP_TOP 13 LOAD_CONST 3 (2) 16 ROT_TWO 17 LOAD_CONST 4 ('y') 20 STORE_SUBSCR New disassembly: 0 BUILD_MAP 0 3 LOAD_CONST 1 (1) 6 LOAD_CONST 2 ('x') 9 STORE_MAP 10 LOAD_CONST 3 (2) 13 LOAD_CONST 4 ('y') 16 STORE_MAP
This commit is contained in:
parent
eb103b3577
commit
effde12f5f
5 changed files with 19 additions and 5 deletions
|
@ -85,6 +85,7 @@ def_op('DELETE_SLICE+1', 51)
|
|||
def_op('DELETE_SLICE+2', 52)
|
||||
def_op('DELETE_SLICE+3', 53)
|
||||
|
||||
def_op('STORE_MAP', 54)
|
||||
def_op('INPLACE_ADD', 55)
|
||||
def_op('INPLACE_SUBTRACT', 56)
|
||||
def_op('INPLACE_MULTIPLY', 57)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue