DEP201 / Simplified URL routing progress report

94 views
Skip to first unread message

Sjoerd Job Postmus

unread,
Jun 12, 2017, 12:32:09 AM6/12/17
to Django developers (Contributions to Django itself)
Hi all,

I finally had some more time to continue on the WIP implementation of DEP201, and spent it on getting two missing items working:

* Showing the supplied argument to `path` in the technical 404 page.
* Making `path` work with "lazy" (think `ugettext_lazy`) arguments.

I also (finally) reserved a dedicated test-folder `urlpatterns` for some (as of now 1) tests.

However, in doing so I "had" to get rid of a minor performance optimisation: the caching of `.regex` using LocaleRegexDescriptor, so there might be a performance drawback in case one does not use the lazy/translateable URLs. I'm not sure if this performance drawback is going to be significant enough to actually be bothered by it.

Another issue that I now have is that if one does not use the `reverse` functionality, the needed parts are now prepared (whereas before, loading this was delayed until the first call to `reverse`).

If possible, I would really appreciate it if somebody could do a brief review of the code to check if it's not getting "too bad".

During the upcoming week I hope to complete the set of test-cases and have the code functioning. How should I proceed from there?

Kind regards,
Sjoerd Job Postmus

Adam Johnson

unread,
Jun 13, 2017, 4:34:16 PM6/13/17
to django-d...@googlegroups.com
For those who don't know, the PR is here: https://github.com/django/django/pull/7482
 
However, in doing so I "had" to get rid of a minor performance optimisation: the caching of `.regex` using LocaleRegexDescriptor, so there might be a performance drawback in case one does not use the lazy/translateable URLs. I'm not sure if this performance drawback is going to be significant enough to actually be bothered by it.

That's probably a big one, I think most apps don't use translated URL's. Also at DUTH last year Carl Meyer talked about how Instagram has custom code to cache their translated URL's as well so it's clearly worth it for some applications :) But I'm sure we can work out a way to keep caching.

Another issue that I now have is that if one does not use the `reverse` functionality, the needed parts are now prepared (whereas before, loading this was delayed until the first call to `reverse`).

 I don't think this is such a worry, I haven't seen a Django app that doesn't use reverse(), and I guess the memory usage isn't going to be too high.

Anyway, looking good, keep up the good work!

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscribe@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/220dbc21-fcae-41f7-9ce5-f57176ad8420%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Adam
Reply all
Reply to author
Forward
0 new messages