Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
FAQ
Register
Log In
Run results for:
Slice vs Map (2222211111)
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36 Edg/147.0.0.0
Browser:
Chrome 147
Operating system:
Windows
Device Platform:
Desktop
Date tested:
5 months ago
Benchmark engine:
Benchmark.js
slice
134K/s
map
131K/s
View exact numbers
Test name
Executions per second
✓
slice
134,015 Ops/sec
map
131,317 Ops/sec
Tests:
slice
var item = 10; var index = 50; var array = Array.from({length: 100}); var array2 = [...array.slice(0, index), item, ...array.slice(index + 1)];
map
var item = 10; var index = 50; var array = Array.from({length: 100}).map((val, i) => i === index ? item : val);