Rails is a powerful framework. You can write a lot of features in a short period of time. In the process you can easily write code that performs poorly.
At OmbuLabs we like to maintain Ruby on Rails applications. In the process of maintaining them, adding features and fixing bugs, we like to improve the code and its performance (because we are good boy scouts!)
Here are some tips based on our experience.
Prefer where
instead of select
When you are performing a lot of calculations, you should load as little as possible into memory. Always prefer a SQL query vs. an object’s method call.
Read more