Isiah Meadows isiahmeadows at
Sat Jul 1 09:47:41 UTC 2017

I'm honestly not convinced how this is actually useful. And also, just
based on the name, I'd expect it to be something closer to `[min, max]
= Math.minMax(foo, bar)`, which could effectively compile down for
integers to up to two register `mov`s followed by a single `cmpxchggt`
(compare and exchange if greater than).

Not that engines couldn't similarly reduce this equivalent, but
engines are usually way dumber than they could be with some of the
more complex reductions:

// This should compile to the same thing assuming `foo` and
// `bar` are both integers, but no engine AFAIK does this.
var min = foo, max = bar;
if (min > max) { var tmp = max; max = min; min = tmp }

// This should also compile similarly, provided `foo` and `bar`
// are both integers and constant reference reads.
var min = Math.min(foo, bar)
var max = Math.max(foo, bar)

Isiah Meadows
me at

Looking for web consulting? Or a new website?
Send me an email and we can get started.

On Fri, Jun 30, 2017 at 7:47 AM, Xavier Stouder <xavier at> wrote:
> I just removed performance from goals of the proposal, given how it seems to
> depend about how min and max are called.
> Thanks for feedbacks.
> _______________________________________________
> es-discuss mailing list
> es-discuss at

More information about the es-discuss mailing list