new array vs loop for large string

Benchmark created by xiaoyuze on


Test runner

Ready to run.

Testing in
TestOps/sec
new array
var str;
str = new Array(10000).join('x');
ready
loop
var str = '';
for (var i = 0; i < 9999; i++) {
  str += 'x'
}
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.

  • Revision 1: published by xiaoyuze on