ruby String += considered harmful
In real code, we found a very, very slow loop. Changing two characters: += is about 100 seconds. << is around 1/3 of a second. Using += on a string creates a copy and then discards the original, while << allows the ruby interpreter to intelligently resize the buffer. The only gotcha is that << will mutate your string object, which means that it’s not safe to use on a...