String Concat vs Array Join

Benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
String Concatenation (+= Operator)
var result = '';
for (var i = 0; i < 1000; i++) {
  result += 'a';
}
ready
Array Join (join() Method):
var arr = [];
for (var i = 0; i < 1000; i++) {
  arr.push('a');
}
var result = arr.join('');
ready

Revisions

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