Hacker News new | ask | show | jobs
by Trezoid 4644 days ago
One thing I'd also recommend for speeding up django is swapping in djinja. Straight drop in replacement for almost the entire template engine, but much faster.
3 comments

This trick will speed-up django template significantly

https://docs.djangoproject.com/en/dev/ref/templates/api/#dja...

What do you lose by using djinja instead of the builtin template engine?
You primarily lose a few of the django filters, though they can all be implemented into the jinja filters if you need to
Wouldn't this also mean you have to re-implement any filters that come from third-party apps, too?
Benchmarks, please. I've yet to find a case where that was true in a real-world project outside of … dubious … designs where someone was using a dozen nested if/for blocks to avoid writing a templatetag.

In one memorable case, someone switched an entire site over to Jinja before doing any profiling – I reverted it and added select_related() to avoid doing 8,000 queries while generating the page.