¿Podrían compartir algún benchmark que lo demuestre?
Carlos León
[ Moderator ]
from Barranquilla, Colombia
Este es el código y el resultado para la prueba hecha en jruby 1.6.4 (ruby-1.9.2-p136) (2011-08-23 17ea768) (Java HotSpot™ 64-Bit Server VM 1.6.026) [darwin-x8664-java]
n = 10_000_000
Benchmark.bm do |x|
x.report("assign single") { n.times do; c = 'a string'; end}
x.report("assign double") { n.times do; c = "a string"; end}
x.report("concat single") { n.times do; 'a string ' + 'b string'; end}
x.report("concat double") { n.times do; "a string " + "b string"; end}
end
user system total real
assign single 0.871000 0.000000 0.871000 ( 0.872000)
assign double 0.542000 0.000000 0.542000 ( 0.543000)
concat single 1.459000 0.000000 1.459000 ( 1.459000)
concat double 1.325000 0.000000 1.325000 ( 1.325000)
El script fue tomado como referencia de esta url http://goo.gl/mei2Z
