Test case details

Preparation Code

const arr = new Array(100000).fill(0).map(e => Math.random())

Test cases

Test #1

const arr1 = Object.groupBy(arr, e => (e * 10).toFixed(2).toString())

Test #2

const arr2 = {} arr.forEach(e => { const key = (e * 10).toFixed(2).toString(); arr2[key] ??= []; arr2[key].push(e); })