Skip to content

Commit

Permalink
Getting rid of xrange since it's not in Python 3 and does not affect …
Browse files Browse the repository at this point in the history
…the benchmark.
  • Loading branch information
Omer Katz committed Jun 25, 2014
1 parent 7f77450 commit b8d5687
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def cprofile_main():
class Noddy(Document):
fields = DictField()

for i in xrange(1):
for i in range(1):
noddy = Noddy()
for j in range(20):
noddy.fields["key" + str(j)] = "value " + str(j)
Expand Down Expand Up @@ -128,7 +128,7 @@ def main():
db = connection.timeit_test
noddy = db.noddy
for i in xrange(10000):
for i in range(10000):
example = {'fields': {}}
for j in range(20):
example['fields']["key"+str(j)] = "value "+str(j)
Expand All @@ -151,7 +151,7 @@ def main():
db = connection.timeit_test
noddy = db.noddy
for i in xrange(10000):
for i in range(10000):
example = {'fields': {}}
for j in range(20):
example['fields']["key"+str(j)] = "value "+str(j)
Expand Down Expand Up @@ -181,7 +181,7 @@ class Noddy(Document):
"""

stmt = """
for i in xrange(10000):
for i in range(10000):
noddy = Noddy()
for j in range(20):
noddy.fields["key"+str(j)] = "value "+str(j)
Expand All @@ -197,7 +197,7 @@ class Noddy(Document):
print(t.timeit(1))

stmt = """
for i in xrange(10000):
for i in range(10000):
noddy = Noddy()
fields = {}
for j in range(20):
Expand All @@ -215,7 +215,7 @@ class Noddy(Document):
print(t.timeit(1))

stmt = """
for i in xrange(10000):
for i in range(10000):
noddy = Noddy()
for j in range(20):
noddy.fields["key"+str(j)] = "value "+str(j)
Expand All @@ -231,7 +231,7 @@ class Noddy(Document):
print(t.timeit(1))

stmt = """
for i in xrange(10000):
for i in range(10000):
noddy = Noddy()
for j in range(20):
noddy.fields["key"+str(j)] = "value "+str(j)
Expand All @@ -247,7 +247,7 @@ class Noddy(Document):
print(t.timeit(1))

stmt = """
for i in xrange(10000):
for i in range(10000):
noddy = Noddy()
for j in range(20):
noddy.fields["key"+str(j)] = "value "+str(j)
Expand All @@ -263,7 +263,7 @@ class Noddy(Document):
print(t.timeit(1))

stmt = """
for i in xrange(10000):
for i in range(10000):
noddy = Noddy()
for j in range(20):
noddy.fields["key"+str(j)] = "value "+str(j)
Expand Down

0 comments on commit b8d5687

Please sign in to comment.