Repository navigation
Introduce caching for strict templates - #189
Conversation
Currently, in Vento strict mode, templates are re-evaluated every time they are run, because the variables passed to the template can change. This introduces a "strict cache", i.e. cache for strict mode, which caches templates separately based on the variables passed to them. This improves performance significantly, since most of the time, the templates receive the same set of variables.
|
This is a smart solution, thank you! |
711dd31 to
83d8dfb
Compare
|
Of course! I added a test that checks the keys in By the way, I found using a |
|
Thank you!.
That's interesting. I suspect |
Currently, in Vento strict mode, templates are re-evaluated every time they are run, because the variables passed to the template can change.
This introduces a "strict cache", i.e. cache for strict mode, which caches templates separately based on the variables passed to them. This improves rendering performance significantly, since most of the time, the templates receive the same set of variables. On my laptop I'm seeing an improvement to the rendering benchmark of more than 50%!
Note that this respects Vento's
env.cache.clear()because the variable-based caches are attached to the template objects, which are deleted upon clearing withenv.cache.clear().