Fork me on GitHub

performance

    rolling out with feature flags

    02 Sep 2012

    Richard Huang

    Sometimes you may face the situation that some features will be released, but you are not sure if it is friendly to end user, or if it will lead to performance issues, at that time you should use what we called "feature flags" Read More

    Tags 


    Optimize db migration

    30 Oct 2011

    Richard Huang

    rails migration provides a convenient way to alter database structure, you can easily add, change and drop column to a existing table, but when the data in existing table are huge, it will take a long time to alter existing table, you should try to merge/optimize the db alter sql statements. Read More

    Tags 


    Active Record Query Interface Optimization

    23 Jun 2011

    Angelo Capilleri

    Use select with has_many and belongs_to on Active Record Associations Read More

    Tags 


    Use memoization

    22 Nov 2010

    Richard Huang

    Memoization is an optimization technique used primarily to speed up computer programs by having function calls avoid repeating the calculation of results for previously-processed inputs. In rails, you can easily use memoize which is inherited from ActiveSupport::Memoizable. Read More

    Tags 


    Select specific fields for performance

    19 Oct 2010

    Richard Huang

    In a system like forum, the title and body is displayed on show page, but only title is on index page. You should use select in query to speed up the query and save memory. Read More

    Tags 


    Use batched finder for large data query

    09 Sep 2010

    Richard Huang

    If you want to do a large data query such as finding all the 10,000,000 users to send email to them, you should use batched finder to avoid eating too much memory. Read More

    Tags 


    Put scripts at the bottom

    30 Aug 2010

    Richard Huang

    Do you experience that your website renders slow due to loading a lot of javascripts, especially loading some third-party javascripts? Move script tags to the bottom of body can speed up the render of your website. Read More

    Tags 


    Use css sprite automatically

    15 Aug 2010

    Richard Huang

    Using css sprite can reduce a large number of http requests, so it makes the web page loaded much faster. It it painful to composite a lot of images manually, do it automatically. Read More

    Tags 


    Use asset_host for production server

    31 Jul 2010

    Richard Huang

    Use asset host for cookie-free domains for components, that make your components load faster. Read More

    Tags