Mercurial > cpython-lru_cache-weakref
diff Python/import.c @ 51920:ef8fe9088696 legacy-trunk
Backport r69961 to trunk, replacing JUMP_IF_{TRUE,FALSE} with
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.
| author | Jeffrey Yasskin <jyasskin@gmail.com> |
|---|---|
| date | Sat, 28 Feb 2009 19:03:21 +0000 |
| parents | ca098fc18ec6 |
| children | 1ef3da6c434c |
line wrap: on
line diff
--- a/Python/import.c Sat Feb 28 15:50:40 2009 +0000 +++ b/Python/import.c Sat Feb 28 19:03:21 2009 +0000 @@ -72,9 +72,11 @@ Python 2.6a0: 62151 (peephole optimizations and STORE_MAP opcode) Python 2.6a1: 62161 (WITH_CLEANUP optimization) Python 2.7a0: 62171 (optimize list comprehensions/change LIST_APPEND) + Python 2.7a0: 62181 (optimize conditional branches: + introduce POP_JUMP_IF_FALSE and POP_JUMP_IF_TRUE) . */ -#define MAGIC (62171 | ((long)'\r'<<16) | ((long)'\n'<<24)) +#define MAGIC (62181 | ((long)'\r'<<16) | ((long)'\n'<<24)) /* Magic word as global; note that _PyImport_Init() can change the value of this global to accommodate for alterations of how the
