From: "Jean-François" Date: 2007-01-11T01:24:22+09:00 Subject: Re: String performance Robert :> robert@fussel /cygdrive/c/temp> $ cat str_bench.rb> require 'benchmark'>> n = 1_000_000> c = "stuff">> A = "a"> B = "b">> Benchmark.bmbm do |x|> x.report('\'a\' +') { n.times {'a' + c + 'b'}}> x.report('"a" +') { n.times {"a" + c + "b"}}> x.report('a#{') { n.times {"a#{c}b"}}> x.report('"" <<') { n.times {"" << "a" << c << "b"}}> x.report('"a" <<') { n.times {"a" << c << "b"}}>> x.report('A +') { n.times {A + c + B}}> x.report('"" << A') { n.times {"" << A << c << B}}> end Hi, You can add the format way also : "a%sb" % c x.report('a%sb') { n.times { "a%sb" % c }} slower than string interpolation. -- Jean-François. -- À la renverse.