Array.join vs plus operator

Benchmark created by Yury on


Test runner

Ready to run.

Testing in
TestOps/sec
Array.join
var arr = [];
for (var i = 0; i < 10000; i++) {
  arr.push(i);
}
var result = arr.join(', ')
ready
plus operator
var result = '';
for (var i = 0; i < 9999; i++) {
  result += i + ', ';
}
result += i;
ready

Revisions

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