Raymond Hettinger rhettin...@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
Antoine Pitrou pit...@free.fr added the comment:
Committed to py3k in r67839.
--
resolution: accepted - fixed
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue2183
___
Antoine Pitrou pit...@free.fr added the comment:
Here is a new patch against trunk and fixing the documentation for
LIST_APPEND.
--
nosy: +pitrou
stage: - patch review
versions: +Python 2.7, Python 3.1 -Python 2.6
Added file: http://bugs.python.org/file12369/list-comp-opt3.patch
Raymond Hettinger rhettin...@users.sourceforge.net added the comment:
This looks like a major improvement, not just for speed, but for getting
rid of the _[1] arguments setup, retrieval, and deletion.
I presume it has been tested with nested and conditional variants?
def f(): return [x
Antoine Pitrou pit...@free.fr added the comment:
I presume it has been tested with nested and conditional variants?
The whole test suite runs fine. test_iter and test_grammar seem to cover
all possible cases.
As for performance, the new benches in #4677 show a moderate improvement
(~ 10%).
Raymond Hettinger rhettin...@users.sourceforge.net added the comment:
This is a nice cleanup.
Marking as accepted.
Go ahead and apply.
--
assignee: nnorwitz - pitrou
resolution: - accepted
___
Python tracker rep...@bugs.python.org
Changes by Jeffrey Yasskin jyass...@gmail.com:
--
nosy: +jyasskin
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue2183
___
___
Python-bugs-list
Antoine Pitrou pit...@free.fr added the comment:
I've fixed the Python compiler package and committed it all in r67818.
Will port to py3k.
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue2183
___
Antoine Pitrou pit...@free.fr added the comment:
I have started porting to py3k and I've applied the same optimizations
to set and dict comprehensions. I just have a question: I have created
an opcode MAP_ADD which is very similar to STORE_MAP, except that it
takes as argument the stack offset
Antoine Pitrou pit...@free.fr added the comment:
FWIW, here's the py3k patch.
--
versions: -Python 2.7
Added file: http://bugs.python.org/file12372/py3k-comps.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue2183
Raymond Hettinger rhettin...@users.sourceforge.net added the comment:
Will take a look in the morning and get back to you on the MAP_ADD question.
--
assignee: pitrou - rhettinger
___
Python tracker rep...@bugs.python.org
Sean Reifschneider [EMAIL PROTECTED] added the comment:
Neal: Can you make that doc change?
--
assignee: - nnorwitz
nosy: +jafo
priority: - normal
__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2183
__
Neal Norwitz [EMAIL PROTECTED] added the comment:
Ya, I'll get around to it...hopefully soon. But if someone wants to
do it for me, I won't complain. :-)
__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2183
__
Alexander Belopolsky added the comment:
The patch looks reasonable to me. Bytecode docs need to be changed. At
minimum like this:
===
--- Doc/library/dis.rst (revision 61097)
+++ Doc/library/dis.rst (working copy)
@@ -463,9 +463,9
New submission from Neal Norwitz:
Optimize list comprehensions by using the list on the stack, rather than
storing in a (local/global) variable. This reduces the size of the
stack by one pointer, reduces the bytecode size by 8, and reduces the
iterations in the eval loop by 2 + # of iterations
15 matches
Mail list logo