The Fun and Magical World of Benchmarking

What is benchmark you might ask?

Benchmark is a built-in ruby module that lets you measure how long it takes for your code to execute and this can be useful in many ways. For one, in the overdramatize example above, coders often realize there are multiple ways to implement a method/solution, but whether it’s worth implementing or not can be quite taunting to decide. If there are no significant difference in performance, let’s not tamper with code that works perfectly fine. However, for certain situations, it can provide a tremendous performance boost to your application.

Getting started

Since the Benchmark module is already included in ruby, you won’t need to install any gems.

YMMV, but I’m running on a 2.8 GHz Intel Core i7 processor.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store