Module: MyBenchmark

Defined in:
lib/custom_fields.rb

Class Method Summary collapse

Class Method Details

.measure(caption, &block) ⇒ Object



76
77
78
79
80
81
# File 'lib/custom_fields.rb', line 76

def self.measure(caption, &block)
  t1 = Time.now
  returned_value = block.call
  puts "[MyBenchmark] #{caption} took #{((Time.now - t1) * 1000).to_i} ms"
  returned_value
end