EmilStenstrom / django-components

Create simple reusable template components in Django.
MIT License
1.15k stars 75 forks source link

Benchmark for template caching? #709

Open JuroOravec opened 1 week ago

JuroOravec commented 1 week ago

This is low priority for me, but would be cool to know the answer to.

In the docs (v0.102) for the template caching, we state that:

"As the same component is often used many times on the same page, these savings add up."

However, Django docs (v5.1) for the Template class say that:

The system only parses your raw template code once – when you create the Template object. From then on, it’s stored internally as a tree structure for performance.

So from the wording it seems that Django already caches the Template objects automatically.

There's still value to caching on our end, because we have to post-process those templates, e.g. extract the {% slot %} and {% fill %} tags, and we cache those results.

But it'd be great to have a clear picture of how Django's template caching works exactly. And to know what impact our caching has.

EmilStenstrom commented 5 days ago

Similar to https://github.com/EmilStenstrom/django-components/issues/14