cache-crispies icon indicating copy to clipboard operation
cache-crispies copied to clipboard

Add support for preloading related data for missing collection entries

Open Nerian opened this issue 2 years ago • 2 comments

Hi,

This PR adds a preloads method to add a hook so we can preload relations in collections so that we can avoid n+1 issues

Nerian avatar Apr 20 '22 11:04 Nerian

Thanks @Nerian. I pushed up some changes to address a failing spec. It looks like it caused some merge conflicts. Sorry about that.

About the PR, I like the idea of this. However, I'm a bit concerned that it could have a negative impact on performance since there is so much logic being added, especially in the case where there is a cache hit. Would you be willing to do some performance comparisons, with and without this change?

adamcrown avatar Jun 07 '22 05:06 adamcrown

We have been using this for a few months in production and it has worked fine. But I added more changes in some other branch so maybe I will rebase this branch with all these changes and submit again.

I like the idea of measuring performance difference between versions of cache-crispies. Is there a rake task I can use for that, or should I write one? Should I perhaps use this? https://github.com/codenoble/cache-crispies-performance-comparison

Nerian avatar Jun 07 '22 08:06 Nerian