id,summary,reporter,owner,description,type,status,component,version,severity,resolution,keywords,cc,stage,has_patch,needs_docs,needs_tests,needs_better_patch,easy,ui_ux 4566,URL reverse() function has something like O(n^2) behaviour. Could be better.,Malcolm Tredinnick,Malcolm Tredinnick,"Two improvements that we should implement in URL resolving: 1. Both reverse() and resolve() construct a RegexURLResolver instance every time they are called. Since that instance only varies based on the value of ''urlconf'', we can have a module-level cache that stores the instance using ''urlconf'' as the key and only creates it when the right key doesn't exist. That saves one scan through the list of URL patterns each time, on average. 2. Reverse resolving does a linear scan through the list of patterns looking for a name to match. Since these names are known in advance, we can build up a hash table mapping view function names and url names to patterns, turning the linear scan into an O(1) lookup.",,closed,Core (Other),dev,,fixed,performance,,Ready for checkin,1,0,0,0,0,0