benchmarking Blogs
Written by Kiprosh, team of passionate and disciplined craftsmen turning your ideas into reality.
Kiprosh is now part of LawLytics
Written by Kiprosh, team of passionate and disciplined craftsmen turning your ideas into reality.
Lets say we need to benchmark and evaluate the performance of code snippet. This is how we can easily do on Rails console using "Benchmark.ms" require 'benchmark' 1.9.3-p392 :001 > Benchmark.measure do 1.9.3-p392 :002 > "john mark McMillan".split(" ").collect{|word|word[0] = word[0].upcase; word}.join(" ") 1.9.3-p392 :003?> end => #<Benchmark::Tms:0x00007ff6cd8face8 @label="", @real=1.600012183189392e-05, @cstime=0.0, @cutime=0.0, @stime=2.9999999999960614e-06, @utime=1.8999999999991246e-05, @total=2.1999999999987307e-05 1.9.3-p392 :004 > Benchmark.