Here is an article comparing various URL dispatchers:
http://mindref.blogspot.com/2012/10/python-web-routing-benchmark.html
What cause django URL dispatcher that much... slow?
That said, if you really think Django's urlresolver is to slow, go ahead, profile it and improve it, we certainly won't say no to speed improvements…
BUT... Django is NOT that fast.
The list goes on. What is the harm in discussing the weak points of Django? Performance is probably the only major weak point in Django right now (aside from the lack of schema migration in core, which is coming soon anyway).
I have no solution or patches in my pocket, but I can say with absolute certainty that performance will never, ever get better when discourse is in a monologue format.
So, the benchmarks are interesting. They tell us which stacks are
fully featured, and which stacks are very lightweight. Apart from
that, they don't tell us much at all - is Django's template engine
slow, or is it about right for the work it does? This benchmark
doesn't tell us that, it only says it is slower than a bare bones
template engine, which is unsurprising, and shouldn't be a cause for
concern.
Django can survive (and thrive) just fine in its current, reasonably performant state, but performance should have a priority, rather than being in a sort of "its fine as-is" stasis.
Benchmarks like the ones posted aren't that helpful, but it doesn't change the fact that there tends to be an anti-performance sentiment in this group. When you look at the latest Python 3.3.x release, you see that there are many performance improvements that are clearly not due to incidental changes. I'm merely suggesting that an initiative to better the performance of Django, perhaps by benchmarking to find some of the weakest points, determining the lowest hanging fruit, and creating tickets in trac for them. I would love to help optimize any given part of Django and submit a patch, but not if I'm afraid that it will never be applied and/or the ticket will be marked as "works for me", etc. Help give us who care about performance the most a real chance to make some improvements.
I absolutely agree with: if we were looking for speed we wouldn't use python at all (period).
--
You received this message because you are subscribed to the Google Groups "Django developers" group.
Now that I've looked in detail at the test, it is because the test isnonsensical. Each time it tests the URLs, it constructs a fresh WSGI
application. Each fresh application has to compile each URL in the
urlconf before using it. It then destroys the application, and starts
another one up.
That said - could Django be faster? Sure. *Anything* can be improved.
So, if you've got a suggestion, make it. If you think URL resolving is
the source of the problem, propose a way to improve the speed of URL
resolvers. If you think the template language is the problem, propose
a fix.
FWIW, here's a link to a cProfile result for the mentioned
benchmark[1] on Django 1.4.1 and CPython 2.7.3. A quick look shows
that we're calling get_language() 1.5mln times (read: for every
pattern), so that's definitely going to slow down things.