Skip to content

Instantly share code, notes, and snippets.

@robholland
Created December 3, 2009 12:08
Show Gist options
  • Save robholland/248104 to your computer and use it in GitHub Desktop.
Save robholland/248104 to your computer and use it in GitHub Desktop.
require 'benchmark'
count = 10000
Benchmark.bm do |x|
x.report { a = []; count.times { a += [1] } }
x.report { a = []; count.times { a.concat([1]) } }
end
# user system total real
# 0.230000 0.010000 0.240000 ( 0.240109)
# 0.030000 0.000000 0.030000 ( 0.029889)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment