Created
May 13, 2009 14:57
-
-
Save anonymous/111067 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' | |
include Benchmark | |
n = 1000000 | |
Benchmark.bm do |test| | |
test.report("Double quotes:") do | |
n.times do |x| | |
str = "A string with a \newline" | |
str = "Interpolates #{12345}" | |
end | |
end | |
test.report("Single quotes:") do | |
n.times do |x| | |
str = 'A string with a \newline' | |
str = 'Interpolates #{12345}' | |
end | |
end | |
end | |
# user system total real | |
# Double quotes: 5.490000 2.120000 7.610000 ( 7.652372) | |
# Single quotes: 4.220000 2.100000 6.320000 ( 6.345824) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment