branch | development |
changeset 2599 | 388b25528e07 |
parent 2598 | 94ae3f5f4df1 |
child 2731 | 13f5be2bf83b |
2598:94ae3f5f4df1 | 2599:388b25528e07 |
---|---|
1 #!/usr/bin/env ruby |
1 #!/usr/bin/env ruby |
2 puts "EXECUTION TIME: N/A" |
2 require 'benchmark' |
3 |
3 |
4 class MethodInvocation |
|
5 def do_smth |
|
6 self |
|
7 end |
|
8 end |
|
9 |
|
10 results = Benchmark.bmbm do |bm| |
|
11 raise "Expecting one arg - num of invocations" if ARGV.size == 0 |
|
12 n = ARGV[0].to_i |
|
13 inst = MethodInvocation.new |
|
14 |
|
15 bm.report do |
|
16 n.times { inst.do_smth } |
|
17 end |
|
18 end |
|
19 puts "EXECUTION TIME: #{results[0].real * 1000.0}" |
|
20 |