benpickles (owner)

Revisions

gist: 127811 Download_button fork
public
Public Clone URL: git://gist.github.com/127811.git
bench.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
require 'benchmark'
 
Dir.mkdir('results') unless File.exists?('results')
$stdout = File.new("results/#{Process.pid}.txt", 'w')
 
puts "Start: #{Time.now.strftime('%H:%M:%S')}"
 
array = (1..1000000).map { rand }; nil
 
Benchmark.bmbm do |x|
  x.report('sort!') { array.dup.sort! }
  x.report('sort') { array.dup.sort }
end
 
puts "Finish: #{Time.now.strftime('%H:%M:%S')}"
 
 
multi.sh
1
2
3
4
5
6
echo Running $1 times...
 
for ((i = 1; i <= $1; i++)) do
ruby bench.rb &
done