benchmarks/methodinvocation.rb
author Jan Vrany <jan.vrany@fit.cvut.cz>
Mon, 16 Sep 2013 01:04:57 +0100
branchdevelopment
changeset 2733 3d97124aebf5
parent 2731 13f5be2bf83b
permissions -rwxr-xr-x
Fixes for syntax highlighting. Even full class source is fully parser and indexed as the parser seems to be fast enough (at least at i5 CPU).

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