Kaydet (Commit) e555f581 authored tarafından Antoine Pitrou's avatar Antoine Pitrou

Issue #4677: add two list comprehension tests to pybench.

üst 1ffbfbc5
......@@ -190,6 +190,11 @@ Library
- Issue #4730: Fixed the cPickle module to handle correctly astral characters
when protocol 0 is used.
Tools/Demos
-----------
- Issue #4677: add two list comprehension tests to pybench.
Build
-----
......
......@@ -293,3 +293,58 @@ class SmallLists(Test):
for i in xrange(self.rounds):
pass
class SimpleListComprehensions(Test):
version = 2.0
operations = 6
rounds = 20000
def test(self):
n = range(10) * 10
for i in xrange(self.rounds):
l = [x for x in n]
l = [x for x in n if x]
l = [x for x in n if not x]
l = [x for x in n]
l = [x for x in n if x]
l = [x for x in n if not x]
def calibrate(self):
n = range(10) * 10
for i in xrange(self.rounds):
pass
class NestedListComprehensions(Test):
version = 2.0
operations = 6
rounds = 20000
def test(self):
m = range(10)
n = range(10)
for i in xrange(self.rounds):
l = [x for x in n for y in m]
l = [y for x in n for y in m]
l = [x for x in n for y in m if y]
l = [y for x in n for y in m if x]
l = [x for x in n for y in m if not y]
l = [y for x in n for y in m if not x]
def calibrate(self):
m = range(10)
n = range(10)
for i in xrange(self.rounds):
pass
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment