I was profiling a Django 1.8 site when I noticed something peculiar. The function was called 50 times and took a cumulative time of 229 ms, almost half the page load time. django.template.engine.get_template The site uses a lot of tags to render different elements on the page, such as ad positions and related story boxes. template Django’s template system will read and compile a template every time it is rendered. This happens quickly, but when you render multiple templates on each page it can add up, just like in my case. After searching around for a solution I discovered , which when enabled stores compiled templates in memory, reducing the time to retrieve templates. django.template.loaders.cached.Loader Once cached template loader was enabled on the site the cumulative time of went right down to 1 ms, reducing page load times by ~200 ms. django.template.engine.get_template was introduced in Django 1.2, but wasn’t enabled by default and it can be quite easy to miss. Cached template loader Before you enable cached template loader you will need to ensure that all your custom . template tags are thread-safe Starting from 1.11 cached template loader is enabled by default when the setting is set as False. Django DEBUG If you are still on an older version of Django and use a lot of template tags, enable cached template loader, it can speed up your site tremendously. is how hackers start their afternoons. We’re a part of the family. We are now and happy to opportunities. Hacker Noon @AMI accepting submissions discuss advertising & sponsorship To learn more, , , or simply, read our about page like/message us on Facebook tweet/DM @HackerNoon. If you enjoyed this story, we recommend reading our and . Until next time, don’t take the realities of the world for granted! latest tech stories trending tech stories