Created
December 2, 2008 04:43
-
-
Save epitron/30998 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
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