[Python-bugs-list] [Bug #130010] Nasty case for comparison performance
noreply@sourceforge.net
noreply@sourceforge.net
Wed, 24 Jan 2001 21:14:42 -0800
Bug #130010, was updated on 2001-Jan-24 21:14
Here is a current snapshot of the bug.
Project: Python
Category: Python Interpreter Core
Status: Open
Resolution: None
Bug Group: None
Priority: 1
Submitted by: tim_one
Assigned to : gvanrossum
Summary: Nasty case for comparison performance
Details: Test case:
def timeeq(x, y):
from time import clock
import sys
assert len(x) == len(y)
print "comparing dicts of len", len(x), "...",
sys.stdout.flush()
s = clock()
result = x == y
f = clock()
print round(f-s, 1), "seconds"
sys.stdout.flush()
d = {}
e = {}
timeeq(d, e)
d[0] = d
e[0] = e
timeeq(d, e)
d[1] = d
e[1] = e
timeeq(d, e)
d[2] = d
e[2] = e
timeeq(d, e)
Under current CVS, output is:
comparing dicts of len 0 ... 0.0 seconds
comparing dicts of len 1 ... 0.0 seconds
comparing dicts of len 2 ... 6.5 seconds
comparing dicts of len 3 ...
There's no sign that the 3-element dict compare will ever terminate (killed
it after 15 minutes on a quiet machine).
This is actually a huge improvement over Python 2.0, though! There it
spins (seemingly) forever comparing the 2-element dicts.
Note that I put this at priority 1 (lowest).
For detailed info, follow this link:
http://sourceforge.net/bugs/?func=detailbug&bug_id=130010&group_id=5470