Analyze and Compare Measurements Using Statistics

Despite our best efforts to isolate our code from external factors, there will still be a variation in our measurements when we run the same code over and over again. Most of the time this won’t bother us. For example, if our code takes from 10 to 15 seconds before optimization and from 1 to 2 seconds after, we won’t need any statistics to tell us that our optimization worked.

But sometimes things do not look as certain. For example, say we optimized the code and the execution time went down from the 120--150 ms range to the 110--130 ms range. How can we be sure that the perceived optimization of 10--20 ms is the result of our change and not some random factor?

To answer such questions, we’ll ...

Get Ruby Performance Optimization now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.