benchmarks/methodinvocation.rb
changeset 2678 c865275e48a7
child 2731 13f5be2bf83b
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/benchmarks/methodinvocation.rb	Fri Sep 06 02:45:44 2013 +0200
@@ -0,0 +1,20 @@
+#!/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}"
+