Most efficient way to generate a really long string (tens of megabytes) in JS
<p>I find myself needing to synthesize a ridiculously long string (like, tens of megabytes long) in JavaScript.  (This is to slow down a CSS selector-matching operation to the point where it takes a measurable amount of time.)</p>

<p>The best way I've found to do this is</p>

<pre><code>var really_long_string = (new Array(10*1024*1024)).join("x");
</code></pre>

<p>but I'm wondering if there's a more efficient way - one that doesn't involve creating a tens-of-megabytes array first.</p>
