string concatenation

JavaScript performance comparison

Revision 17 of this test case created by Subodh Jadhav

Preparation code


      
      <script>
Benchmark.prototype.setup = function() {
  var s, S, A, SS, bs, tl;

};
</script>

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
array join concatenation (all at once)
SS = [
'aa',
'bb',
'cc',
'dd',
'ee',
'ff',
'gg',
'hh',
'ii'
].join('');
pending…
array join concatenation
S = [];
S.push('aa');
S.push('bb');
S.push('cc');
S.push('dd');
S.push('ee');
S.push('ff');
S.push('gg');
S.push('hh');
S.push('ii');
S = S.join('');
pending…
string with backslash
bs = 'aa\
bb\
cc\
dd\
ee\
ff\
gg\
hh\
ii';
pending…
regular concatenation
s = '';
s += 'aa';
s += 'bb';
s += 'cc';
s += 'dd';
s += 'ee';
s += 'ff';
s += 'gg';
s += 'hh';
s += 'ii';
pending…
Template literals
tl = `aa
bb
cc
dd
ee
ff
gg
hh
ii`;
pending…
array init and set before join
A = new Array(9);
A[0] = 'aa';
A[1] = 'bb';
A[2] = 'cc';
A[3] = 'dd';
A[4] = 'ee';
A[5] = 'ff';
A[6] = 'gg';
A[7] = 'hh';
A[8] = 'ii';
A = A.join('');
pending…

Compare results of other browsers

Revisions

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

0 Comments