secret
Created

  • Download Gist
results.txt
1 2 3
user system total real
9.940000 0.090000 10.030000 ( 10.038922)
3.420000 0.000000 3.420000 ( 3.429747)
smelly_code.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13
require 'rubygems'
require 'benchmark'
 
array = [["banana", "apple"], ["pineapple","beer"]]
 
Benchmark.bm do |x|
x.report do
1000000.times { array.collect { |sa| sa.collect(&:reverse) } }
end
x.report do
1000000.times { array.collect { |sub_array| sub_array.collect { |subsub_array| subsub_array.reverse } } }
end
end

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.