I've just started playing around with fastify & nunjucks as I'd like to use it for a project, but noticed the performance seemed slow. Had a poke around and point-of-view is setting up the nunjucks environment on each request, which is expensive, so I've made a change to set it up on load.
Here are some before and after autocannon numbers for a simple fastify-cli generated project, rendering a basic nunjucks view:
Hi,
I've just started playing around with fastify & nunjucks as I'd like to use it for a project, but noticed the performance seemed slow. Had a poke around and point-of-view is setting up the nunjucks environment on each request, which is expensive, so I've made a change to set it up on load.
Here are some before and after autocannon numbers for a simple fastify-cli generated project, rendering a basic nunjucks view:
Before
After
Checklist
npm run test
andnpm run benchmark