Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
FAQ
Register
Log In
map vs slice
(version: 1)
Benchmark.js
Comparing performance of:
slice vs map
Created:
9 days ago
by:
Guest
Go to the latest result
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
/*your preparation JavaScript code goes here To execute async code during the script preparation, wrap it as function globalMeasureThatScriptPrepareFunction, example:*/ async function globalMeasureThatScriptPrepareFunction() { // This function is optional, feel free to remove it. // await someThing(); }
Tests:
slice
const array = Array.from({length: 100}) const anotherArray = [...array.slice()]
map
const array = Array.from({length: 100}) const anotherArray = array.map((i)=>i)
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
slice
map
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
9 days ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:155.0) Gecko/20100101 Firefox/155.0
Browser/OS:
Firefox 155 on Mac OS X 10.15
View result in a separate tab
Embed
Embed Benchmark Result
slice
1.7M/s
map
1.5M/s
View exact numbers
Test name
Executions per second
✓
slice
1,662,027 Ops/sec
map
1,508,851 Ops/sec
Related benchmarks
reate array by lenght
Pushing
Array.from length vs Array
(Fixed) Array.from length vs Array
(Small Array.from length vs Array
Array.from length vs for loop
Array.from() vs slice.call()
Array.from({ length }) vs new Array()
array creation (Array vs Array.from)
Comments
Confirm delete:
Do you really want to delete benchmark?