django-render-block icon indicating copy to clipboard operation
django-render-block copied to clipboard

Django nodes cache

Open iurisilvio opened this issue 2 years ago • 3 comments

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.

iurisilvio avatar Apr 09 '22 10:04 iurisilvio

Looks like this needs black run against it for formatting! 👍

clokep avatar Apr 11 '22 18:04 clokep

Yes, I ran black and fixed the formatting.

iurisilvio avatar Apr 11 '22 22:04 iurisilvio

I added a commit here to support anonymous templates. It is a case where template.name is None, so it was clashing cache keys.

iurisilvio avatar Nov 09 '22 19:11 iurisilvio