﻿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
17892	Calling RegexURLResolver.__repr__ takes a lot of time (and memory)	milosu	nobody	"I have an application which has about 70K RegexURLPatterns.

When I try to access some non-existent url in this app under Django 1.4RC1, it takes a huge amount of time - I mean 1 or 2 minutes - to generate the technical 404 response and also the memory consumption goes from 220MB to something about 460MB.

The problem is in a call to RegexURLResolver.__repr__, which is called about 3 times during the technical 404 debug response. It looks like the whole RegexURLResolver including all its sub-patterns is being recursively traversed during a call to __repr__.

I had to patch RegexURLResolver.__repr__ to cut this CPU overhead.

Patch attached, but I'm not sure how to write a test case for it.

I'm also attaching the profiling results of unpatched Django 1.4RC.

I'm upgrading from Django 1.2.3 so I'm not sure if this behaviour is present in 1.3 or if it is new to 1.4, but from my point of view this is a release blocker.
"	Bug	closed	Core (URLs)	1.4-beta-1	Normal	fixed			Accepted	1	0	0	0	0	0
