Sometimes we need to benchmark the execution time of a code segment to check the performance.
For this we can use the `Benchmark` library available in Rails like below.
puts '====== Start benchmark ========' time = Benchmark.realtime { ... Code being tested goes here ... } puts time puts '====== End benchmark =========='
No comments:
Post a Comment