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

Optimize but Don’t Break

We’ll start our profiling session by writing a test and a benchmark. Why? Because optimization means making changes to the code, most often to its core part. Sometimes, optimization requires complex architectural changes. And we should be able to make substantial changes without fearing we’ll break things. This is why we need the test. We’ll use the test to make sure we didn’t break anything during optimization. Benchmarking is important because, as you’ll see later, the speedup in the profiler won’t always translate to the same improvement in the real world. So we need to measure our code’s performance before and after optimization to ensure that things got faster.

We’ll embed the test directly into the application ...

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