At the moment, I cannot figure out if there is a way to conditionally preload an association given a certain request. At the moment, custom_preload is invoked with the models and the requests associations.
I think it would be beneficial to also have access to the optional fields (are there other possibilities of bottlenecks?) in the custom_preload method to allow custom preloading. At the moment, I am preloading optional fields on every request which has an impact on memory used -- even when it is not necessary for a subset of requests.
Or better yet: a field and an association should provide a preload interface that can be automatically pooled to maximize usage of the preloader and minimize unnecessary memory usage.
At the moment, I cannot figure out if there is a way to conditionally preload an association given a certain request. At the moment,
custom_preloadis invoked with the models and the requests associations.I think it would be beneficial to also have access to the optional fields (are there other possibilities of bottlenecks?) in the
custom_preloadmethod to allow custom preloading. At the moment, I am preloading optional fields on every request which has an impact on memory used -- even when it is not necessary for a subset of requests.Or better yet: a
fieldand anassociationshould provide apreloadinterface that can be automatically pooled to maximize usage of the preloader and minimize unnecessary memory usage.