Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Benchmark: chunk array by slice VS splice
chunk 100k element array into 1k elements chunks
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Mobile Safari/537.36 EdgA/142.0.0.0
Browser:
Chrome Mobile 142
Operating system:
Android
Device Platform:
Mobile
Date tested:
5 months ago
Test name
Executions per second
slice
66685896.0 Ops/sec
splice
66363316.0 Ops/sec
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) }