我是来打酱油的 nodejs 伪砖家
1.9.3p125 :005 > a = 'a' => "a" 1.9.3p125 :006 > b = 'b' => "b" 1.9.3p125 :007 > c = 'a' + 'b' => "ab" 1.9.3p125 :008 > c.object_id => 3560360 1.9.3p125 :009 > a => "a" 1.9.3p125 :010 > d = a << b => "ab" 1.9.3p125 :011 > d.object_id => 3579120 1.9.3p125 :012 > a.object_id => 3579120 1.9.3p125 :013 > a => "ab"
大概理解了
1.9.3p125 :003 > Benchmark.measure{ 100000.times { c = 'a' + 'b' }} => 0.050000 0.000000 0.050000 ( 0.045099)
1.9.3p125 :004 > Benchmark.measure{ 100000.times { c = 'a' << 'b' }} => 0.040000 0.000000 0.040000 ( 0.038751)
看来确实