Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Javascript string to array mapping: Array.from() vs Spread syntax [...spread] vs split
(version: 1)
Comparing performance of:
Array.from vs [...spread] vs split
Created:
one year ago
by:
Guest
Go to the latest result
Script Preparation code:
var string = '1'.repeat(1000);
Tests:
Array.from
const array = Array.from(string);
[...spread]
const array = [...string];
split
const array = string.split('');
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
Array.from
[...spread]
split
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:138.0) Gecko/20100101 Firefox/138.0
Browser/OS:
Firefox 138 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
split
961K/s
[...spread]
206K/s
Array.from
201K/s
View exact numbers
Test name
Executions per second
✓
split
960,784 Ops/sec
[...spread]
206,485 Ops/sec
Array.from
201,206 Ops/sec
Related benchmarks
spread vs slice vs splice
Javascript string to array mapping: Array.from() vs Spread syntax [...spread]
Simple array spread vs array push
Array.from() vs spread []
toSpliced vs Spread
Comments
Confirm delete:
Do you really want to delete benchmark?