]> granicus.if.org Git - python/commit
Issue #6690: Optimize the bytecode for expressions such as `x in {1, 2, 3}`,
authorAntoine Pitrou <solipsis@pitrou.net>
Sat, 16 Jan 2010 18:37:38 +0000 (18:37 +0000)
committerAntoine Pitrou <solipsis@pitrou.net>
Sat, 16 Jan 2010 18:37:38 +0000 (18:37 +0000)
commitb7fbcd396fc4a366433cf6f26cae64fecb056099
tree15efa75386a0f8e2d8381267a0c2edd6b551aac3
parenta8f480f54597cf20e460b12e17bb0416a8008868
Issue #6690: Optimize the bytecode for expressions such as `x in {1, 2, 3}`,
where the right hand operand is a set of constants, by turning the set into
a frozenset and pre-building it as a constant.  The comparison operation
is made against the constant instead of building a new set each time it is
executed (a similar optimization already existed which turned a list of
constants into a pre-built tuple).  Patch and additional tests by Dave
Malcolm.
Lib/test/test_peepholer.py
Misc/NEWS
Python/peephole.c