Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

13 lines (10 sloc) 0.338 kb
require "benchmark"
STR1 = "Hello"
JOIN = "::"
STR2 = "World"
TESTS = 100_000
Benchmark.bmbm do |results|
results.report("concat") { TESTS.times { "".concat(STR1).concat(JOIN).concat(STR2) } }
results.report("add ") { TESTS.times { STR1 + JOIN + STR2 } }
results.report("join ") { TESTS.times { [STR1, STR2].join(JOIN) } }
end
Jump to Line
Something went wrong with that request. Please try again.