Large 1KB string concat (v200)

Revision 200 of this benchmark created on


Description

Test string concatenation with large strings.

Setup

s="1234567890abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890abcdefghij";

Test runner

Ready to run.

Testing in
TestOps/sec
concat
for(var res = '', i = 0; i < 10000; i++){
res+=s;
}
ready
join-with-push
for(var res = [], i = 0; i < 10000; i++){
res.push(s);
}
res=res.join('');
ready
join-without-push
for(var res = [], i = 0; i < 10000; i++){
res[i]=s;
}
res = res.join('');
ready
concat-pure
for (var res = '', i = 0; i < 10000; i++){
res=res.concat(s);
}
ready
concat old-fashioned
for(var res = '', i = 0; i < 10000; i++){
res=res+s;
}
ready
repeat
res=s.repeat(10000);
ready

Revisions

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