concat/join-with-push/join-without-push (v78)

Revision 78 of this benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
concat
for (var res = '', i = 0; i < 10000; i++) {
  res += 'a';
}
ready
join-with-push
for (var res = [], i = 0; i < 10000; i++) {
  res.push('a');
}
res = res.join('');
ready
join-without-push
for (var res = [], i = 0; i < 10000; i++) {
  res[i] = 'a';
}
res = res.join('');
ready
Join with preallocation
for (var res = new Array(10000), i = 0; i < 10000; i++) {
  res[i] = 'a';
}
res = res.join('');
ready
join
for (var res = new Array(), i = 0; i < 10000; i++) {
  res[i] = 'a';
}
res = res.join('');
ready

Revisions

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