django-render-block
django-render-block copied to clipboard
Django nodes cache
It is really slow to parse templates everytime you call render_block
and it is a static information, so you can cache it in memory.
I did some benchmarking here and this node cache improved performance ~20%.
Most part of the work was done by @walison17, I just wrote a test and did the benckmark.
Looks like this needs black
run against it for formatting! 👍
Yes, I ran black and fixed the formatting.
I added a commit here to support anonymous templates. It is a case where template.name is None
, so it was clashing cache keys.