Closed mweberxyz closed 7 months ago
Can you replace hashlru with toad-cache (LruMap) in another PR?
We try to use that for all the packages now, unless there is a significant perf regression
Actually, just checked the PR again and it looks to me like this function gets called once?
Is that not the case?
It gets called a single time for a globally defined layout.
It gets called on every request (via layoutIsValid
) for a reply-defined layout, ie -
reply.view('index-for-layout.ejs', { text: 'text' }, { layout: 'layout.html' })
Marked as draft to let https://github.com/fastify/point-of-view/pull/416 and the subsequent toad-lru
PR merge first to avoid conflict.
Specifying a layout on render causes a synchronous
fs.accessSync
on every request. Cache the result of these lookups in LRU to avoid duplicate blocking checks.Benchmarks (master)
Benchmarks (PR)
Checklist
npm run test
andnpm run benchmark