O'Reilly logo

Ruby Performance Optimization by Alexander Dymo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required