I'm rendering a list of fairly large items with deep relations so I want to optimize my use of the cache.
To do that, I've gone through the trouble of selectively loading deep includes (i.e. an include tree that includes all relations needed for rendering) only if the hash fragment is out of date for the particular item. Items that I know are in the fragment cache only load direct attributes and any relations needed to evaluate the cache_key.
Unfortunately, even though the reusable items have hashes cached at the top level, the relations are still being traversed by rabl as part of the map_engines_to_builders call in Rabl::MultiBuilder::Helpersbefore the cache is checked. This, of course, defeats my careful loading optimizations...
I've tested an optimization that seems to work for me. When it's enabled, the Builder takes a top-level engine that's replaced by a Hash as the return value (instead of trying to merge it with other engines). It also avoids walking the tree prematurely by doing the compile_settings of :child and :glue inside the to_hash instead of on initialization.
Any interest in this? I've got working code that I could submit.
I'm rendering a list of fairly large items with deep relations so I want to optimize my use of the cache.
To do that, I've gone through the trouble of selectively loading deep includes (i.e. an include tree that includes all relations needed for rendering) only if the hash fragment is out of date for the particular item. Items that I know are in the fragment cache only load direct attributes and any relations needed to evaluate the cache_key.
Unfortunately, even though the reusable items have hashes cached at the top level, the relations are still being traversed by rabl as part of the map_engines_to_builders call in
Rabl::MultiBuilder::Helpers
before the cache is checked. This, of course, defeats my careful loading optimizations...I've tested an optimization that seems to work for me. When it's enabled, the Builder takes a top-level engine that's replaced by a Hash as the return value (instead of trying to merge it with other engines). It also avoids walking the tree prematurely by doing the compile_settings of :child and :glue inside the to_hash instead of on initialization.
Any interest in this? I've got working code that I could submit.