Reputation: 84
I have an application where the vast majority of business logic is in the backend. I use django templates along with context variables to populate those templates.
In majority, they are all simple and don't have fancy logic.
My question is: Is there any improvement in terms of performance or readability or any other benefit if I switch from django templates to jinja in this particular case?
Upvotes: 0
Views: 616
Reputation: 735
There will be a performance difference between Jinja and Django templates, but it's a small part of the total performance landscape. In particular, the network roundtrip involved in serving a request is an order of magnitude greater than rendering a template.
From memory the "20×" figure is measured "cold", but in production Django templates will be cached and the performance difference is not as great.
If you've measured a performance problem with one or the other type of template, by all means switch. If you prefer the style of Jinja over Django and haven't written much/any templates yet, that's also a good reason to change. Otherwise, stick with what you have.
Upvotes: 3