Takeaways

Here’s what you learned during this profiling session:

  • Optimization with the profiler is a craft, not engineering.

    You must look at the data, make your best guess at what’s slow, change the code, reprofile, and see whether your optimization worked. Rinse and repeat. The best way to learn this craft is by doing it. The more you profile, the better you understand the results you get, and the better optimization guesses you make.

  • Write tests before profiling.

    You’ll change the code a lot during profiling. Tests are your only way to ensure the program still does what it’s supposed to do.

  • The profiler will tell you what to optimize or where to concentrate your optimization effort.

    In our profiling session example, the profiler ...

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.