Array.from vs Spread Syntax vs Array.prototype.slice vs Array.prototype.concat vs For Loop Push vs For Loop AssignFastest: Array.from (24.1x faster)
6,372,244 ops/sec
6,073,456 ops/sec
6,050,452 ops/sec
5,959,004 ops/sec
801,256 ops/sec
264,849 ops/sec
Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.
| Test case name | Result |
|---|---|
| Array.from | |
| Spread Syntax | |
| Array.prototype.slice | |
| Array.prototype.concat | |
| For Loop Push | |
| For Loop Assign |
| Test name | Executions per second |
|---|---|
| ✓ Spread Syntax | 5,417,269 Ops/sec |
| Array.prototype.slice | 4,214,846 Ops/sec |
| Array.prototype.concat | 3,265,912 Ops/sec |
| Array.from | 2,545,347 Ops/sec |
| For Loop Assign | 412,600 Ops/sec |
| For Loop Push | 61,830 Ops/sec |