Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Benchmark: chunk array by slice VS splice
(version: 3)
chunk 100k element array into 1k elements chunks
Comparing performance of:
slice vs splice
Created:
9 months ago
by:
Registered User
Jump to the latest result
Script Preparation code:
const chunkSize = 100 const arr = []; for (var i = 0; i < 10000; i++) { list.push(i); }
Tests:
slice
const res = [] for (let i = 0; i < arr.length; i += chunkSize) { res.push(arr.slice(i, i + chunkSize)) }
splice
const res = [] while (arr.length > 0) { const chunk = arr.splice(0, chunkSize) res.push(chunk) }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
slice
splice
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
28 days ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:6.8) Goanna/20260403 PaleMoon/34.2.0
Browser/OS:
Pale Moon (Firefox Variant) 34 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
slice
5043977.5 Ops/sec
splice
5024631.5 Ops/sec
Related benchmarks:
Last item in array Slice vs Length - 1
native-slice-vs-chunk-real
Last item in array Slice vs Length - 1 vs array.at
Last item in array Slice vs Length - 1 vs At -1
Last item in array Slice vs Length - 1 vs .at
Last item in array Slice vs Length - 1 vs at(-1)
chunk perf
slice version 2
Getting last element of array (index/slice/at/pop)
Comments
Confirm delete:
Do you really want to delete benchmark?