Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
string concat 3 ways
(version: 0)
Compare setAttribute to dataset
Comparing performance of:
Create Array and Join vs Array join only vs es6 vs old school vs Update array and join;
Created:
4 years ago
by:
Guest
Jump to the latest result
Script Preparation code:
var foo = 'foo'; var bar = 'bar'; var baz = 'baz'; var arr = [foo, bar, baz];
Tests:
Create Array and Join
var i = 10000; while (i--) { var str = [foo, bar, baz].join(' '); }
Array join only
var i = 10000; while (i--) { var str = arr.join(' '); }
es6
var i = 10000; while (i--) { var str = `${foo} ${bar} ${baz}`; }
old school
var i = 10000; while (i--) { var str = foo + ' ' + bar + ' ' + baz; }
Update array and join;
var i = 10000; var updateArr = []; while (i--) { updateArr[0] = foo; updateArr[1] = bar; updateArr[2] = baz; var str = updateArr.join(' '); }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (5)
Previous results
Fork
Test case name
Result
Create Array and Join
Array join only
es6
old school
Update array and join;
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Related benchmarks:
Test concat vs spread operator
spread vs concat
Issou by Ruskie
spread vs. concat
test1 array concat vs spred 3
Comments
Confirm delete:
Do you really want to delete benchmark?