caktus / django-scribbler

django-scribbler is an application for managing snippets of text for a Django website.
http://readthedocs.org/docs/django-scribbler/
BSD 2-Clause "Simplified" License
115 stars 13 forks source link

Template rendering performance #158

Open PetrDlouhy opened 3 years ago

PetrDlouhy commented 3 years ago

I just realised, that if I delete all scribbles from my template, the template rendering times are 100-300 ms shorter (measured by https://pypi.org/project/django-debug-toolbar-template-profiler/ with user logged off). This is significant performance issue for me, since it can be 1/3 or more of the whole request time.

I will investigate this further.

PetrDlouhy commented 3 years ago

I have gone a bit further with the investigation. I find out, that the biggest hurdle is getting the cache key (https://github.com/caktus/django-scribbler/blob/master/scribbler/templatetags/scribbler_tags.py#L54). This single command lasts 30-50ms for every scribble on the page, even thou the cache debug toollbar measures that getting the cache key to ~0.5ms.

I use Redis cache backend.

Sorry, that was false lead - the delay was caused by the cache debug toolbar.