From: Erik Veenstra Date: 2006-08-26T15:30:54+09:00 Subject: Re: map and join or inject? ---------------------------------------------------------------- $ vi test.rb ; cat test.rb GC.disable 1000.times do (1..1000).map{|s| s.to_s}.join("") #(1..1000).inject(""){|r, s| s.to_s; r} end count = 0 ObjectSpace.each_object do count += 1 end p count $ ruby test.rb 1003392 ---------------------------------------------------------------- $ vi test.rb ; cat test.rb GC.disable 1000.times do #(1..1000).map{|s| s.to_s}.join("") (1..1000).inject(""){|r, s| s.to_s; r} end count = 0 ObjectSpace.each_object do count += 1 end p count $ ruby test.rb 2001392 ---------------------------------------------------------------- gegroet, Erik V. - http://www.erikveen.dds.nl/