4 ms·
That's interesting to learn... I always assumed caching is a necessary evil if you want to speed things up. I certainly feel like rendering views is rails is
by gingerlime 8y ago
That's interesting to learn...
I always assumed caching is a necessary evil if you want to speed things up.
I certainly feel like rendering views is rails is slower than I'd like it to be (talking about the rendering part alone), especially with partials.
How do you deal with views that pull dynamic data that produce a heavy query however?
- nathan_long 8y agoIf the query was expensive and could be run periodically, I'd either create a materialized view that gets refreshed as often as necessary (maybe by https://dockyard.com/blog/2017/11/29/need-an-elixir-dependency-to-manage-recurring-jobs-not-so-fast https://dockyard.com/blog/2017/11/29/need-an-elixir-dependen...) or use a GenServer process for caching that data (as you might do with Redis otherwise). I don't think the view rendering itself would ever be a performance issue, but rendering a view is just a function call in Phoenix, so I could take a similar approach there - store it in a GenServer.