title: Ruby differences between += and << to concatenate a string
body: <p>On Ruby 1.8.7 I was doing a loop concatenating strings when found out that there seems to be a HUGE difference between <code>&lt;&lt;</code> and <code>+=</code> on a <code>String</code> object:</p>
  
  <pre><code> y = ""
   start = Time.now
   99999.times { |x| y += "some new string"  }
   puts "Time: #{Time.now - start}"
   # Time: 31.56718
  
   y=''
   start = Time.now
   99999.times { |x| y &lt;&lt; "some new string"  }
   puts "Time: #{Time.now - start}"
   # Time: 0.018256
  </code></pre>
  
  <p>I google about that, found some results:</p>
  
  <p><a href="http://www.rubylove.info/post/1038516765/difference-between-string-concatenation-ruby-rails" rel="noreferrer">http://www.rubylove.info/post/1038516765/difference-between-string-concatenation-ruby-rails</a></p>
  
  <p>Says that <code>&lt;&lt;</code> modifies both strings, while <code>+=</code> only modify the caller. I don't understand why is then <code>&lt;&lt;</code> faster.</p>
  
  <p>Next I went to the Ruby doc, but I wonder WHY there is no method <code>+=</code></p>
  
  <p><a href="http://ruby-doc.org/core-2.2.0/String.html" rel="noreferrer">http://ruby-doc.org/core-2.2.0/String.html</a></p>