benchmarks/methodinvocation.rb
author Claus Gittinger <cg@exept.de>
Fri, 07 Jun 2019 22:52:13 +0200
branchcvs_MAIN
changeset 3903 e0870fe108eb
parent 2678 c865275e48a7
child 2731 13f5be2bf83b
permissions -rwxr-xr-x
#REFACTORING by cg class: ProxyMethod changed: #printStringForBrowserWithSelector:inClass: (send #withColor: instead of #colorizeAllWith:)

#!/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}"