benchmarks/strcat.rb
author Claus Gittinger <cg@exept.de>
Thu, 27 Jun 2019 12:42:13 +0200
branchcvs_MAIN
changeset 3920 47a7b4a23bee
parent 2598 94ae3f5f4df1
permissions -rwxr-xr-x
#DOCUMENTATION by cg class: JavaLanguage comment/format in: #sourceFileSuffix

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