Hi,<div><br></div><div>To understand where the bottleneck is you have to profile your app. </div><div><br></div><div>To improve your DB performance you could check if there are new versions of your DBMS. For instance MySql 5.5 is faster the 5.1. You could use memcached to reduce DB access time. Are you searching data using the DB or do you use Sphinx or Elastic Search? By moving your queries to a search engine you will remove the load from you DB and your searches will be faster.</div>
<div><br></div><div>I do not know if ERB is faster than HAML but I think you should choose the one you are more confortable to develop with. I prefer HAML because it makes my views cleaner than ERB.</div><div><br></div><div>
Selecting only the columns you need will make your app a bit faster, not sure how much, you should see it from a profilers' report.<br><br><div class="gmail_quote">On 23 November 2012 13:17, Frederick Cheung <span dir="ltr"><<a href="mailto:frederick.cheung@gmail.com" target="_blank">frederick.cheung@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Have you profiled your code?<br>
<br>
Initialisation of active record objects does definitely take time, so dropping down to select_all will save you some cycles, and obviously not fetching columns from the DB will help too. Without profiling you won't know whether that's the hot spot though.<br>
<br>
Fred<br>
<div><div class="h5"><br>
On 23 Nov 2012, at 12:14, Jonathon Horsman <<a href="mailto:jonathon@arctickiwi.com">jonathon@arctickiwi.com</a>> wrote:<br>
<br>
> Hi<br>
><br>
> I need to improve the performance of a particular Rails action.<br>
><br>
> I'm using fragment caching which is helping a lot, but the initial cache generation is still in the order of 5 seconds.<br>
><br>
> So I'm looking into the garbage collector, this article provided some hints but no suggestions: <a href="http://merbist.com/2010/07/29/object-allocation-why-you-should-care/" target="_blank">http://merbist.com/2010/07/29/object-allocation-why-you-should-care/</a><br>
><br>
> e.g. how do I reduce the amount of object allocation in Rails? Should I be using the select() method in ActiveRecord to reduce initialized fields?<br>
> Is it better to use select_all and work directly with hashes?<br>
><br>
> Is HAML markedly slower than ERB? The view generation seems to take the majority of time.<br>
><br>
> I'd really appreciate any tips or links to articles.<br>
><br>
> Many thanks<br>
><br>
> --<br>
> Jonathon Horsman<br>
> Director<br>
> Arctic Kiwi<br>
> Mobile: 079 42366038<br>
> Web: <a href="http://www.arctickiwi.com" target="_blank">http://www.arctickiwi.com</a><br>
> Twitter: @jhorsman<br>
><br>
><br>
</div></div>> _______________________________________________<br>
> Chat mailing list<br>
> <a href="mailto:Chat@lists.lrug.org">Chat@lists.lrug.org</a><br>
> <a href="http://lists.lrug.org/listinfo.cgi/chat-lrug.org" target="_blank">http://lists.lrug.org/listinfo.cgi/chat-lrug.org</a><br>
<br>
<br>_______________________________________________<br>
Chat mailing list<br>
<a href="mailto:Chat@lists.lrug.org">Chat@lists.lrug.org</a><br>
<a href="http://lists.lrug.org/listinfo.cgi/chat-lrug.org" target="_blank">http://lists.lrug.org/listinfo.cgi/chat-lrug.org</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>Riccardo Tacconi<br>Ruby on Rails and PHP development - System Administration<br><a href="http://virtuelogic.net/" target="_blank">VIRTUELOGIC LIMITED</a><br>
<br><a href="http://github.com/rtacconi" target="_blank">http://github.com/rtacconi</a><br><a href="http://riccardotacconi.blogspot.com" target="_blank">http://riccardotacconi.blogspot.com</a><br><a href="http://twitter.com/rtacconi" target="_blank">http://twitter.com/rtacconi</a><br>
</div>