<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-GB link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Ref ERB vs HAML: in about May 2011 we replaced a lot of haml with erb because it was faster in our use case. We did some proof of concept work first to see if there was a difference and saw a speedup in view rendering of 10 - 20%. So “measurably” faster but not “orders of magnitude” faster. We decided it was worthwhile to do, but we knew it wasn’t going to make a dramatic difference on its own. And bear in mind this was all a long time ago and I wouldn’t normally take stats from 18 months ago too seriously today. <o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>a<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> chat-bounces@lists.lrug.org [mailto:chat-bounces@lists.lrug.org] <b>On Behalf Of </b>Riccardo Tacconi<br><b>Sent:</b> 23 November 2012 12:37<br><b>To:</b> Frederick Cheung<br><b>Cc:</b> London Ruby Users Group<br><b>Subject:</b> Re: [LRUG] Recommendations for Ruby & Rails optimisation resources<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Hi,<o:p></o:p></p><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>To understand where the bottleneck is you have to profile your app. <o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>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.<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>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.<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal style='margin-bottom:12.0pt'>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.<o:p></o:p></p><div><p class=MsoNormal>On 23 November 2012 13:17, Frederick Cheung <<a href="mailto:frederick.cheung@gmail.com" target="_blank">frederick.cheung@gmail.com</a>> wrote:<o:p></o:p></p><p class=MsoNormal>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<o:p></o:p></p><div><div><p class=MsoNormal><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>><o:p></o:p></p></div></div><p class=MsoNormal style='margin-bottom:12.0pt'>> _______________________________________________<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><o:p></o:p></p></div><p class=MsoNormal><br><br clear=all><o:p></o:p></p><div><p class=MsoNormal><o:p> </o:p></p></div><p class=MsoNormal>-- <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><o:p></o:p></p></div></div></body></html>