Author: jbronn
Date: 2010-09-10 21:30:39 -0500 (Fri, 10 Sep 2010)
New Revision: 13743
Modified:
django/branches/releases/1.2.X/django/utils/datastructures.py
Log:
[1.2.X] Fixed #12632 -- Improved performance of `SortedDict`. Thanks, Alex
Gaynor.
Backport of r13742 from trunk.
Modified: django/branches/releases/1.2.X/django/utils/datastructures.py
===================================================================
--- django/branches/releases/1.2.X/django/utils/datastructures.py
2010-09-11 02:28:16 UTC (rev 13742)
+++ django/branches/releases/1.2.X/django/utils/datastructures.py
2010-09-11 02:30:39 UTC (rev 13743)
@@ -99,9 +99,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.