well

On Mon, Aug 10, 2015 at 6:15 PM, joe <[email protected]> wrote:

> I actually like `[1, 2, 3, 4, 5, 6].contains(a)` better, too.  The
> question is, will engines actually optimize it.
>
>
if the entire environment never touches even "by accident" the
`Array.prototype` I don't see why that couldn't be optimized by the engine
... but in general, if a *small* `Array#contains` is the performance
 bottleneck of any application I think there's probably something else
wrong there, or maybe the only better performance approach would be a
`switch` with all cases well defined with a `break` (as someone somewhere
suggested once about a speedy subset of JS)

Regards
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to