Chapter 5Learn to Optimize with the Profiler

The profiler gives you plenty of information with different reports and visualizations. To optimize, your job is to take all that information, make an educated guess on what might be slow, optimize that, reprofile, and see whether your guess was correct.

Profiling is always guesswork. There’s nothing deterministic except for the general routine of profile, guess, optimize, then profile again and repeat. Do not expect an ultimate profiler report that will magically tell you what’s slow. Every report or visualization is looking into your app’s performance from one specific angle. You might be able to see the problem from that angle, but most often you will not. Worse, miscounting and double counting ...

Get Ruby Performance Optimization now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.