pbs/django-cms — pull request #25 by laurafeier (2014-05-27 10:23:20+00:00)
Title: Page form field choices - performance improvement

Having a cms project with CMS_MODERATOR on False, one language and 12483 page titles in the database(all linked to draft pages), the following was executed:

python -m timeit -v -n 1 -r 20 -s "from cms.forms.utils import update_site_and_page_choices" "update_site_and_page_choices('en')"

Results before these changes:
raw times: 3.18 2.74 2.85 3.59 3.27 3.32 3.71 3.31 2.85 2.74 2.77 2.79 2.78 2.96 2.78 2.81 2.78 3.04 2.94 2.96
1 loops, best of 20: 2.74 sec per loop

Results after these changes:
raw times: 0.659 0.62 0.561 0.628 0.613 0.626 0.671 0.663 0.632 0.634 0.583 0.52 0.52 0.599 0.601 0.563 0.663 0.541 0.607 0.622
1 loops, best of 20: 520 msec per loop