Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
String split + join or charAt + concat
Performance differences of using inbuilt string and array methods for splitting and joining char array. Or using loops to extract chars and string concatenation for joining.
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36 Edg/118.0.2088.46
Browser:
Chrome 118
Operating system:
Linux
Device Platform:
Desktop
Date tested:
11 months ago
Test name
Executions per second
split + join
914648.2 Ops/sec
charAt + join
127143864.0 Ops/sec
split + concat
2103521.5 Ops/sec
charAt + concat
201814080.0 Ops/sec
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
const string = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque eget venenatis eros.";
Tests:
split + join
const splitted = string.split(''); const joined = splitted.join('');
charAt + join
const splitted = []; for (let i = 0; i < splitted.length; i++){ splitted.push(splitted[i]); } const joined = splitted.join('');
split + concat
const splitted = string.split(''); let text = ''; for (let i = 0; i < splitted.length; i++){ text += splitted[i] }
charAt + concat
const splitted = []; for (let i = 0; i < splitted.length; i++){ splitted.push(splitted[i]); } let text = ''; for (let i = 0; i < splitted.length; i++){ text += splitted[i] }