It takes the same techniques we learned in Chapter 2, Fix Common Performance Problems to make your Rails application faster:
Optimize memory taken by ActiveRecord by aggressive preloading, selective attribute fetching, and data processing in batches.
Replace explicit iterators in views with render collection, which takes both less time and memory.
Let your database server do your data manipulation.
This and the two previous chapters contain all the advice I can give you to make your Ruby and Rails code faster. Go ahead, apply it, and reap your performance benefits. So why, you may ask, is this not the end of the book? Because any cookbook-style advice is only good for well-known situations. And it leaves you unprepared when performance ...