benchmarks/strcat.rb
author Jan Vrany <jan.vrany@fit.cvut.cz>
Tue, 11 Feb 2014 15:10:40 +0000
branchdevelopment
changeset 3029 bc928fce0f14
parent 2598 94ae3f5f4df1
permissions -rwxr-xr-x
Merged 6d6f9fd894f7 and c04668cd040d

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

results = Benchmark.bmbm do |bm|
  raise "Expecting one arg - num of iterations" if ARGV.size == 0
  n = ARGV[0].to_i
  hello = "hello\n"
  result = ""
  10.times { result << hello }
  bm.report { n.times { result << hello } }
end
puts "EXECUTION TIME: #{results[0].real * 1000.0}"