From: Shyouhei Urabe Date: 2009-03-08T18:09:51+09:00 Subject: [ruby-core:22732] [Bug #1255] += for large strings egrigiously slow Issue #1255 has been updated by Shyouhei Urabe. That's because += generates new strings every time it was called, on the other hand << destructively overwrites existing one. Creation of a string object needs a memory copying, so it takes O(n) time for a n-byte string. So your test takes O(1+2+3+...+1000000), which is O(n^2). I think it's a nature of +=. ---------------------------------------- http://redmine.ruby-lang.org/issues/show/1255 ---------------------------------------- http://redmine.ruby-lang.org