<i>I think the speed increase comes from += creating a new string object every time, whereas << literally concatenates it.</i><p>Programming the hunches and guesses way on the HN frontpage makes me sad.<p><a href="http://ruby-doc.org/core/classes/String.html#M000807" rel="nofollow">http://ruby-doc.org/core/classes/String.html#M000807</a><p>str + other_str => new_str<p>Concatenation Returns a <i>new String</i> containing other_str concatenated to str.<p>str << fixnum => str
str.concat(fixnum) => str
str << obj => str
str.concat(obj) => str<p>Append Concatenates the given object to str. If the object is a Fixnum between 0 and 255, it is converted to a character before concatenation.