Answer the question
In order to leave comments, you need to log in
Ruby on Rails render performance problem
Hello, I have the following partials hierarchy, rendering of which results in a table
render :partial => table
--render :partial => row, :collection => rows
----render :partial => cell, :collection => row.cells
-- ----render :partial => "#{cell.partial}", :locals => {:item => cell.item}
In production, it takes 12 seconds to render 5000 rows
On the same machine, the oracle web interface renders 5000 of those same lines in 2 seconds.
That is 6 times faster.
What is the problem? Is it really that bad in rails, or am I just not understanding something?
We use slim, c haml speed is the same
Answer the question
In order to leave comments, you need to log in
You shoot sparrows from a cannon. Use partials to create a table... Isn't your task solved through helpers?
Start by removing all content_tags. If it does not help, then there are no easy ways to speed it up.
If partials are small, then it makes sense (both in terms of speed and readability) to replace
_table.html.slim
render :partial => row, :collection => rows
_row.html.slimrender :partial => cell, :collection => cells
rows.each_with_index do |row, row_count|
render :partial => cell, :collection => cells
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question