divio/django-cms — pull request #3281 by laurafeier (2014-07-04 08:44:31+00:00)
Title: Performance improvement for get_absolute_url (#1623, #1671)

This is a performance improvement(even with the extra query) that doesn't change the previous logic.
Even if this is fixed in newer versions, it might help.

I ran get_absolute_url() for 30 root pages on a site(which can be considered a common use case when accessing the sitemap) and I got the following times:
* before this change

raw times: 1.31 1.26 1.25 1.27 1.23 1.19 1.2 1.36 1.29 1.29
1 loops, best of 10: 1.19 sec per loop
* after this change

raw times: 0.312 0.283 0.3 0.332 0.321 0.277 0.269 0.291 0.277 0.261
1 loops, best of 10: 261 msec per loop

It looks like it's 4 times better. I tested this on MySQL.