Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
string literal vs array join
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:127.0) Gecko/20100101 Firefox/127.0
Browser:
Firefox 127
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
array.join
1756.1 Ops/sec
string literal
1480.6 Ops/sec
string concatenation
1590.3 Ops/sec
Script Preparation code:
var arr = Array(50000) .fill(1) .map(() => 'A' + Math.ceil(Math.random() * 100));
Tests:
array.join
var res=arr.join('; ');
string literal
var finalString2 = arr.reduce((res, item) => { return `${res}; ${item}`; }, '');
string concatenation
var finalString3 = arr.reduce((res, item) => { return res + '; ' + item; }, '');