aws/aws-sdk-ruby — pull request #285 by bpot (2013-06-28 21:20:04+00:00)
Title: Curb Performance: Use an array of strings instead of a StringIO object.

Using an array is about twice as fast because it doesn't have to keep reallocating the underlying string.

```
require 'benchmark'
require 'stringio'

S = "a" * (32*1024)
N = 1000
Benchmark.bm do |x|
x.report("StringIO") do
buffer = StringIO.new
N.times do
buffer << S
end
buffer.rewind
body = buffer.read
end

x.report("Array") do
buffer = []
N.times do
buffer << S
end
body = buffer.join
end
end

# user system total real
# StringIO 0.040000 0.020000 0.060000 ( 0.056341)
# Array 0.010000 0.020000 0.030000 ( 0.028745)
#
```