YSlow ApnaBill.com ?
March 22nd, 2008
We just finished porting ApnaBill.com from Rails 1.2.5 to Rails 2.0.2 - the port wasn’t that tough, specially with Ben’s Rails2 Upgrade Notes on SlashDotDash.
The steps we took…
- Make your config file reflect the new rails version (make sure you have it installed)
- Move all instances of start_form_tag to form_tag
- Change find_all to find(:all)… this wasn’t an issue with us
- Take care of @session stuff - Rails2 uses session and header instead of @session and @header
With Rails2, comes the caching options for your assets - mainly JS and CSS assets. Checkout changeset 6164 for more details - but somehow combining all css/js into single files at runtime was taking more time than loading them separately in succession. Hence I switched back to asset_packager plugin by Scott Becker - and boy, it works like a charm! It churns out a combined (white-spaces removed) combined css and js files in production mode, while keeping them separately in development mode.


JS and CSS in development mode.

![]()
JS and CSS in production code
And thanks to YSlow, I managed to squeeze a bit more of speed into rendering of the page by moving JS content to as low in the HTML content as possible. As explained by YSlow, CSS should be kept at the top of your HTML while JS as low as possible - reason being - only CSS (most of the times) is required to render the page correctly. So why waste time fetching JS content when it’ll not be needed till the page is fully rendered…

Manage to pimp ApnaBill.com’s YSlow performance grade to D (65) from below 45
Next in queue is how to manage GZip headers in the HTTP requests from ApnaBill.com
Posted in ApnaBill, Rails | Comments (0)