Created
January 30, 2012 13:39
-
-
Save alno/1704455 to your computer and use it in GitHub Desktop.
Benchmark: interpolation vs concatenation in Ruby
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' | |
count = 1000000 | |
Benchmark.benchmark do |bm| | |
bm.report("concat") { count.times { 11.to_s + '/' + 12.to_s } } | |
bm.report("interp") { count.times { "#{11}/#{12}" } } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment