Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #12632 -- Improved performance of `SortedDict`. Thanks, Alex Ga…

…ynor.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@13742 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 1efa80770382d4995c2d6e67972d8a99021ec81f 1 parent a56a226
Justin Bronn authored

Showing 1 changed file with 3 additions and 1 deletion. Show diff stats Hide diff stats

  1. 4  django/utils/datastructures.py
4  django/utils/datastructures.py
@@ -120,9 +120,11 @@ def __init__(self, data=None):
120 120
             self.keyOrder = data.keys()
121 121
         else:
122 122
             self.keyOrder = []
  123
+            seen = set()
123 124
             for key, value in data:
124  
-                if key not in self.keyOrder:
  125
+                if key not in seen:
125 126
                     self.keyOrder.append(key)
  127
+                    seen.add(key)
126 128
 
127 129
     def __deepcopy__(self, memo):
128 130
         return self.__class__([(key, deepcopy(value, memo))

0 notes on commit 1efa807

Please sign in to comment.
Something went wrong with that request. Please try again.