Math.minmax
Xavier Stouder
xavier at stouder.io
Mon Oct 2 15:55:48 UTC 2017
Same for Michael. Useless to not use a reducer instead of Math.min and
Math.max if it has worth performance.
Just to be clear, the fact is that your function approximately costs:
Math.min: one loop over the array
Math.max: one loop over the array
Math.minMax: one loop over the array
Math.minMax do in one pass what Math.min and Math.max do in two passes.
That's the key point.
More information about the es-discuss
mailing list