-
-
Save PatrickTulskie/da98ab48dbe41986a2aa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user system total real | |
9.940000 0.090000 10.030000 ( 10.038922) | |
3.420000 0.000000 3.420000 ( 3.429747) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment