Author: jbronn
Date: 2010-09-10 21:28:16 -0500 (Fri, 10 Sep 2010)
New Revision: 13742
Modified:
django/trunk/django/utils/datastructures.py
Log:
Fixed #12632 -- Improved performance of `SortedDict`. Thanks, Alex Gaynor.
Modified: django/trunk/django/utils/datastructures.py
===================================================================
--- django/trunk/django/utils/datastructures.py 2010-09-11 02:02:20 UTC (rev
13741)
+++ django/trunk/django/utils/datastructures.py 2010-09-11 02:28:16 UTC (rev
13742)
@@ -120,9 +120,11 @@
self.keyOrder = data.keys()
else:
self.keyOrder = []
+ seen = set()
for key, value in data:
- if key not in self.keyOrder:
+ if key not in seen:
self.keyOrder.append(key)
+ seen.add(key)
def __deepcopy__(self, memo):
return self.__class__([(key, deepcopy(value, memo))
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.