rails
rails copied to clipboard
WIP: Add a cache per-request partial lookup cache to lookup context
This adds a fast path for partial lookup on "simple" partial renders.
In this case "simple" means:
- This is a plain partial render, like
render "foo", {...}orrender partial: "foo", locals: {...} - No details are specified (format, handler, locale, variant)
- No block is given (the "layout" form)
When this is the case, this allows a few improvements:
- We cache any simple partial we find in the LookupContext. The LookupContext should only exists for the length of the request and the cache is cleared whenever any details, prefixes, or template paths are changed on the lookup context.
- We go through a new
SimplePartialRendererclass, which skips some of the work done in the regularPartialRenderer(string manipulation of the path/prefix, and building an hash for the options). A relatively minor optimization compared to 1, but very measurable.
cc @byroot