Last active
February 9, 2017 06:40
-
-
Save hiroyukim/0c9db97221034eec92c30c45a6031c7e to your computer and use it in GitHub Desktop.
This file contains hidden or 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 'benchmark' | |
ary = [] | |
ary2 = [] | |
ary3 = [] | |
Benchmark.bm 10 do |r| | |
r.report "+" do | |
10000.times { |n| ary += [n] } | |
end | |
r.report "push" do | |
10000.times { |n| ary2.push(n) } | |
end | |
r.report "<<" do | |
10000.times { |n| ary3 << n } | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment