4 ms·
> Using nested for loops instead of a series of JS array functions is way more efficient but it is not even close to worth it. i work with canvas rendering and
by leeoniya 4y ago
> Using nested for loops instead of a series of JS array functions is way more efficient but it is not even close to worth it.
i work with canvas rendering and 2M-datapoint arrays, so for me it's almost always worth it. but yes, for < 1K elements it isn't. i wrote a 4x faster version of _.groupBy() recently to process our datasets. is a hand-rolled function worth it for 100 elements? not really, but that's not our use case. so, as with everything in life, it depends!