Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
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:
2 years ago
Benchmark engine:
Benchmark.js
array.join
2K/s
string concatenation
2K/s
string literal
1K/s
View exact numbers
Test name
Executions per second
✓
array.join
1,756 Ops/sec
string concatenation
1,590 Ops/sec
string literal
1,481 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; }, '');