benchmarks/methodinvocation.rb
author Claus Gittinger <cg@exept.de>
Thu, 27 Jun 2019 12:42:13 +0200
branchcvs_MAIN
changeset 3920 47a7b4a23bee
parent 2678 c865275e48a7
child 2731 13f5be2bf83b
permissions -rwxr-xr-x
#DOCUMENTATION by cg class: JavaLanguage comment/format in: #sourceFileSuffix

#!/usr/bin/env ruby
require 'benchmark'

class MethodInvocation
  def do_smth
    self
  end
end

results = Benchmark.bmbm do |bm|
  raise "Expecting one arg - num of invocations" if ARGV.size == 0
  n = ARGV[0].to_i
  inst = MethodInvocation.new

  bm.report do 
    n.times { inst.do_smth }
  end
end
puts "EXECUTION TIME: #{results[0].real * 1000.0}"