Cycle Long-Running Instances
Let’s first look at how our program runs, and decide what we can do to make it run faster.
Imagine you started a program. Let’s say it’s a web browser, and after some time it’s become slow. What do you do? It’s not a trick question. You know what you should do: restart it, and it’ll be fast again.
Can we apply the same principle with Ruby programs? It turns out we can. Any long-running Ruby application will become faster after the restart.
Back in Chapter 6, Profile Memory we talked about how garbage collector performance declines when the amount of memory allocated by the Ruby process increases. Spoiler alert: I’m going to jump ahead of myself and add to this one more fact. In most cases the Ruby process ...