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; rv:124.0) Gecko/20100101 Firefox/124.0
Browser:
Firefox 124
Operating system:
Windows
Device Platform:
Desktop
Date tested:
2 years ago
Benchmark engine:
Benchmark.js
map
846K/s
slice
844K/s
View exact numbers
Test name
Executions per second
✓
map
845,934 Ops/sec
slice
843,655 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);