Articles about Performance
Here we continue with the series of articles where we talk about how minor adjustments in the code can lead to major performance improvements.
In this article we'll focus on the use of ActiveRecord::Batches#find_each when it comes to iterations across a large number of records.
Some time ago we wrote a couple of Tips for Writing Fast Rails. It was about time we wrote part two so here it is!
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 Ombu Labs 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.
where instead of
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.