Sha256: b8a58889097459df3f054cce9b58fdce7416807eacb975a4f4cabc31257e65ad
Contents?: true
Size: 338 Bytes
Versions: 126
Compression:
Stored size: 338 Bytes
Contents
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
Version data entries
126 entries across 106 versions & 10 rubygems