I'm working with array chunking at long datasets. I need to create a new array of chunks of a certain size. Currently, I use this solution but it shows bad performance.
function array_to_chunks(data, size){
let chunks = []
let d = data.slice()
while (d.length >= size) chunks.push(d.splice(0, size))
return chunks
}
I'd like to find some better idea of how to do it fast enough and why my code does not perform well.