Skip to content

Instantly share code, notes, and snippets.

@dpaluy
Created November 26, 2012 07:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dpaluy/4147054 to your computer and use it in GitHub Desktop.
Save dpaluy/4147054 to your computer and use it in GitHub Desktop.
Simple benchmark test
#!/usr/bin/env ruby
require 'benchmark'
Benchmark.bm do|b|
b.report("+= ") do
a = ""
500_000.times { a += "." }
end
b.report("<< ") do
a = ""
500_000.times { a << "." }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment