Skip to content

Instantly share code, notes, and snippets.

@epitron
Created December 2, 2008 04:43
Show Gist options
  • Save epitron/30998 to your computer and use it in GitHub Desktop.
Save epitron/30998 to your computer and use it in GitHub Desktop.
require 'benchmark'
bigstring = "bigstring" * 100
n = 1000000
Benchmark.bm do |x|
x.report("<<") { n.times { bigstring.dup << bigstring << bigstring } }
x.report("+") { n.times { bigstring + bigstring + bigstring } }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment