can I ask why nobody is using Math.min/max signature at their full
potentials ?
```js
const [min, max] = [
Math.min.apply(null, array),
Math.max.apply(null, array)
];
```
also, why are benchmarks using `Date.now()` instead of the more accurate
`performance.now()` or the dedicated `console.time('bench') /
console.timeEnd('bench')` utility?
On Mon, Oct 2, 2017 at 3:00 PM, Naveen Chawla <[email protected]> wrote:
> I would be curious about the reduce version that doesn't create a new
> object/array on every iteration:
>
> ```js
> const minMax =
> array.reduce(
> (accumulator, currentValue)=>{
> accumulator.min = Math.min(currentValue, accumulator.min);
> accumulator.max = Math.max(currentValue, accumulator.max);
> return accumulator;
> },
> {
> min: Infinity,
> max: -Infinity
> }
> )
> ```
>
> If you could let me know the relative performance of this in the benchmark
> it would be great.
>
> On Mon, 2 Oct 2017 at 21:43 Xavier Stouder <[email protected]> wrote:
>
>> JDecker: Just added your solution on the benchmark, it beats every
>> others solution and it's a elegant solution.
>>
>> Kai Zhu: We can't see the screenshot. But please take in consideration
>> that it's been a long time that ECMAScript isn't only used in webapp,
>> and that some of applications using it can eat more than a million
>> numbers.
>> _______________________________________________
>> es-discuss mailing list
>> [email protected]
>> https://mail.mozilla.org/listinfo/es-discuss
>>
>
> _______________________________________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
>
>
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss