diff options
author | Raymond Hettinger <python@rcn.com> | 2004-03-07 07:31:06 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2004-03-07 07:31:06 (GMT) |
commit | dd80f762650f42f5f9ae820d9f55b21ed6f33bc0 (patch) | |
tree | f7e7e6545b9896601dd13a1c07e409fef88ede2b /Python/ceval.c | |
parent | bff63f034366b0cf0442e9db5e5674751beca25a (diff) | |
download | cpython-dd80f762650f42f5f9ae820d9f55b21ed6f33bc0.zip cpython-dd80f762650f42f5f9ae820d9f55b21ed6f33bc0.tar.gz cpython-dd80f762650f42f5f9ae820d9f55b21ed6f33bc0.tar.bz2 |
SF patch #910929: Optimize list comprehensions
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.
Diffstat (limited to 'Python/ceval.c')
-rw-r--r-- | Python/ceval.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index 3371844..b20934c 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -1225,6 +1225,15 @@ eval_frame(PyFrameObject *f) if (x != NULL) continue; break; + case LIST_APPEND: + w = POP(); + v = POP(); + err = PyList_Append(v, w); + Py_DECREF(v); + Py_DECREF(w); + if (err == 0) continue; + break; + case INPLACE_POWER: w = POP(); v = TOP(); |