Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Benchmark: interpolation vs concatenation in Ruby
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
You can’t perform that action at this time.