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/142.0.0.0 Safari/537.36 Edg/142.0.0.0
Browser:
Chrome 142
Operating system:
Windows
Device Platform:
Desktop
Date tested:
10 months ago
Benchmark engine:
Benchmark.js
map
399K/s
slice
381K/s
View exact numbers
Test name
Executions per second
✓
map
398,869 Ops/sec
slice
380,660 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);