Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rails, when rendering a partial, each render outputs in the log. Is this a performance hit?

For example if looping over @feed, which renders a partial, you see the following in the log:

Rendered feeds/_feed_item.html.erb (2.5ms)
Rendered feeds/_feed_item.html.erb (1.4ms)
Rendered feeds/_feed_item.html.erb (1.3ms)
Rendered feeds/_feed_item.html.erb (1.3ms)
Rendered feeds/_feed_item.html.erb (1.4ms)
Rendered feeds/_feed_item.html.erb (1.3ms)
Rendered feeds/_feed_item.html.erb (1.3ms)
Rendered feeds/_feed_item.html.erb (1.5ms)
Rendered feeds/_feed_item.html.erb (1.5ms)
Rendered feeds/_feed_item.html.erb (1.3ms)
Rendered feeds/_feed_item.html.erb (1.5ms)
Rendered feeds/_feed_item.html.erb (1.4ms)
Rendered feeds/_feed_item.html.erb (1.3ms)
Rendered feeds/_feed_item.html.erb (1.4ms)
Rendered feeds/_feed_item.html.erb (1.3ms)
Rendered feeds/_feed_item.html.erb (1.3ms)
Rendered feeds/_feed_item.html.erb (1.3ms)
Rendered feeds/_feed_item.html.erb (1.4ms)
Rendered feeds/_feed_item.html.erb (1.3ms)
Rendered feeds/_feed_item.html.erb (1.3ms)
Rendered feeds/_feed_item.html.erb (1.3ms)
Rendered feeds/_feed_item.html.erb (1.4ms)
Rendered feeds/_feed_item.html.erb (1.6ms)
Rendered feeds/_feed_item.html.erb (1.3ms)
Rendered feeds/_feed_item.html.erb (1.5ms)
Rendered feeds/_feed_item.html.erb (1.4ms)
Rendered feeds/_feed_item.html.erb (2.8ms)
Rendered feeds/_feed_item.html.erb (1.5ms)
Rendered feeds/_feed_item.html.erb (2.5ms)
Rendered feeds/_feed_item.html.erb (1.5ms)
Rendered feeds/_feed_item.html.erb (1.8ms)
Rendered feeds/_feed_item.html.erb (1.5ms)
Rendered feeds/_feed_item.html.erb (1.5ms)
Rendered feeds/_feed_item.html.erb (1.4ms)
Rendered feeds/_feed_item.html.erb (1.6ms)
Rendered feeds/_feed_item.html.erb (1.3ms)
Rendered feeds/_feed_item.html.erb (1.5ms)
Rendered feeds/_feed_item.html.erb (1.2ms)
Rendered feeds/_feed_item.html.erb (1.4ms)
Rendered feeds/_feed_item.html.erb (1.5ms)
Rendered feeds/_feed_item.html.erb (1.6ms)

Is that a performance hit? Is there a better way to handle this so it doesn't output every time?

Thanks

like image 932
AnApprentice Avatar asked Jul 26 '11 17:07

AnApprentice


1 Answers

Yes, it's a performance hit. Render a collection.

like image 64
maletor Avatar answered Sep 19 '22 21:09

maletor