[issue2183] optimize list comprehensions

Raymond Hettinger report at bugs.python.org
Thu Dec 18 11:11:16 CET 2008


Raymond Hettinger <rhettinger at users.sourceforge.net> added the comment:

Recommend having both MAP_ADD and STORE_MAP.  The latter is repeated
often in a typical dict literal so it needs to be compact and fast.  The
former needs the flexibility of the offset argument to be workable in a
dict comprehension.  I also like that MAP_ADD eliminates the need for
the awkward ROT_TWO stack re-arrangement.  Also, MAP_ADD can include a
PREDICT(JUMP_ABSOLUTE) for a further speed-up.  All in all, this is a
nice clean-up and speed-up that more than justifies a second opcode.

----------
assignee: rhettinger -> pitrou

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue2183>
_______________________________________


More information about the Python-bugs-list mailing list