4 ms·
> Each partial is an IO read No it's not. Once a partial has been compiled into bytecode, Rails doesn't reach to disk anymore, it's all in memory.
by byroot 4y ago
> Each partial is an IO read
No it's not. Once a partial has been compiled into bytecode, Rails doesn't reach to disk anymore, it's all in memory.
- treis 4y agoThis article says otherwise: https://scoutapm.com/blog/performance-impact-of-using-ruby-on-rails-view-partials https://scoutapm.com/blog/performance-impact-of-using-ruby-o... Maybe it has changed but either way they still can be a bottle neck
- byroot 4y agoYeah, that article is incorrect about the IO part, unless somehow they've been testing in development or something like that. It's however correct that partial rendering is quite more costly than it should, I explain why elsewhere in this thread.
- e12e 4y agoThat gives me a 500 error. At any rate, I think many rails developers should refresh their knowledge of rails caching: https://guides.rubyonrails.org/caching_with_rails.html https://guides.rubyonrails.org/caching_with_rails.html. For example using the data from the db (model instance) as cache key is quite effective solution for being able to deliver most view/fragments from cache. The downside is that some care must be taken with keys, which parts are cached (eg: logged in pages).