On Fri, 2007-06-15 at 07:40 +1000, Malcolm Tredinnick wrote: > On Thu, 2007-06-14 at 14:17 -0700, Smoo.Master wrote: > > I have using django to make a sort of library website. > > > > Since I am mostly using generic views, I use the {% url %} tag (which > > calls reverse) with named url patterns in my templates. However this > > became quite slow (as I verified with the hotshot profiler). On a page > > with several hundred links, it takes thirty seconds just to resolve > > the links. Even on a page with just a few links, it takes a large > > fraction of a second. This is true on both the development server and > > apache with mod_python. > > > > Hardcoding the url patterns in the templates fixes the performance > > problems, but makes them brittle to changes in the url patterns. > > > > any suggestions? > > Make reverse() faster. :-) > > The execution time is related to the number of URL patterns. In fact, > it's O(n^2) for uniformly random lookups (O(n) best case and O(n^2) > worst case if you work through the details). > > There are at least a couple of optimisation possibilities in reverse() > that would cut down on the work; mostly just a matter of finding time, > or a volunteer, to work on them.
Whilst I remembered, I opened ticket #4566 to remind us of this, even if nobody wants to work on it right away. Regards, Malcolm --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---