title: In Ruby how do I generate a long string of repeated text?
body: <p>What is the best way to generate a long string quickly in ruby?  This works, but is very slow:</p>
  
  <pre><code>str = ""
  length = 100000
  (1..length).each {|i| str += "0"}
  </code></pre>
  
  <p>I've also noticed that creating a string of a decent length and then appending that to an existing string up to the desired length works much faster:</p>
  
  <pre><code>str = ""
  incrementor = ""
  length = 100000
  (1..1000).each {|i| incrementor += "0"}
  (1..100).each {|i| str += incrementor}
  </code></pre>
  
  <p>Any other suggestions?</p>