diff options
author | Jeffrey Yasskin <jyasskin@gmail.com> | 2009-02-28 19:03:21 +0000 |
---|---|---|
committer | Jeffrey Yasskin <jyasskin@gmail.com> | 2009-02-28 19:03:21 +0000 |
commit | 68d68520061a5a4aa3437f8c74ba383b2da50280 (patch) | |
tree | aaade0afac9b9369b58c5642e2635fa319f61c02 /Python/import.c | |
parent | de28d6841e60d75ce7644ca527448f73376ec48e (diff) | |
download | cpython-git-68d68520061a5a4aa3437f8c74ba383b2da50280.tar.gz |
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.
Diffstat (limited to 'Python/import.c')
-rw-r--r-- | Python/import.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Python/import.c b/Python/import.c index b00986c697..98b8dceba4 100644 --- a/Python/import.c +++ b/Python/import.c @@ -72,9 +72,11 @@ typedef unsigned short mode_t; 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 |