summaryrefslogtreecommitdiffstats
path: root/Lib/opcode.py
Commit message (Collapse)AuthorAgeFilesLines
* Issue #2333: Backport set and dict comprehensions syntax.Alexandre Vassalotti2010-01-111-0/+2
|
* Issue #2335: Backport set literals syntax from Python 3.x.Alexandre Vassalotti2010-01-091-7/+7
|
* add a SETUP_WITH opcodeBenjamin Peterson2009-05-251-2/+5
| | | | | It speeds up the with statement and correctly looks up the special methods involved.
* Backport r69961 to trunk, replacing JUMP_IF_{TRUE,FALSE} withJeffrey Yasskin2009-02-281-3/+5
| | | | | | POP_JUMP_IF_{TRUE,FALSE} and JUMP_IF_{TRUE,FALSE}_OR_POP. This avoids executing a POP_TOP on each conditional and sometimes allows the peephole optimizer to skip a JUMP_ABSOLUTE entirely. It speeds up list comprehensions significantly.
* Issue #2183: Simplify and optimize bytecode for list comprehensions.Antoine Pitrou2008-12-171-2/+1
|
* Give meaning to the oparg for BUILD_MAP: estimated size of the dictionary.Raymond Hettinger2007-12-181-1/+1
| | | | | | | | | | | Allows dictionaries to be pre-sized (upto 255 elements) saving time lost to re-sizes with their attendant mallocs and re-insertions. Has zero effect on small dictionaries (5 elements or fewer), a slight benefit for dicts upto 22 elements (because they had to resize once anyway), and more benefit for dicts upto 255 elements (saving multiple resizes during the build-up and reducing the number of collisions on the first insertions). Beyond 255 elements, there is no addional benefit.
* Speed-up dictionary constructor by about 10%.Raymond Hettinger2007-12-181-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* PEP 343 -- the with-statement.Guido van Rossum2006-02-271-7/+2
| | | | | | | | | | | | | This was started by Mike Bland and completed by Guido (with help from Neal). This still needs a __future__ statement added; Thomas is working on Michael's patch for that aspect. There's a small amount of code cleanup and refactoring in ast.c, compile.c and ceval.c (I fixed the lltrace behavior when EXT_POP is used -- however I had to make lltrace a static global).
* Install two code generation optimizations that depend on NOP.Raymond Hettinger2004-06-211-0/+1
| | | | Reduces the cost of "not" to almost zero.
* SF patch #910929: Optimize list comprehensionsRaymond Hettinger2004-03-071-0/+1
| | | | | Add a new opcode, LIST_APPEND, and apply it to the code generation for list comprehensions. Reduces the per-loop overhead by about a third.
* Replace backticks with repr() or "%r"Walter Dörwald2004-02-121-1/+1
| | | | From SF patch #852334.
* Revert the previous enhancement to the bytecode optimizer.Raymond Hettinger2003-04-241-2/+0
| | | | The additional code complexity and new NOP opcode were not worth it.
* Improved the bytecode optimizer.Raymond Hettinger2003-04-221-0/+2
| | | | | | | | | | | | | | * Can now test for basic blocks. * Optimize inverted comparisions. * Optimize unary_not followed by a conditional jump. * Added a new opcode, NOP, to keep code size constant. * Applied NOP to previous transformations where appropriate. Note, the NOP would not be necessary if other functions were added to re-target jump addresses and update the co_lnotab mapping. That would yield slightly faster and cleaner bytecode at the expense of optimizer simplicity and of keeping it decoupled from the line-numbering structure.
* new opcode module - extract opcode definitions from dis.py - eventuallySkip Montanaro2003-02-271-0/+188
should be generated automatically