W3C home > Mailing lists > Public > public-script-coord@w3.org > October to December 2013

Re: How to correctly spec sequences requiring an iterable

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Mon, 18 Nov 2013 15:23:53 -0500
Message-ID: <528A7759.8050504@mit.edu>
To: Jonas Sicking <jonas@sicking.cc>
CC: "Tab Atkins Jr." <jackalmage@gmail.com>, Domenic Denicola <domenic@domenicdenicola.com>, "public-script-coord@w3.org" <public-script-coord@w3.org>
On 11/18/13 3:11 PM, Jonas Sicking wrote:
> One thing that very well might be worth optimizing is when a function
> is passed a "plain" Array as the iterable.

Right, that's the only case really worth optimizing.

> We'd of course have to detect that no custom iterator

"fragile and non-trivial".  ;)

> or custom numeric getters

We don't check for that now, we just blindly get using the slow path 
that would handle them, fwiw.  In practice nothing is gated on the 
performance of this bit that I've seen.

> I would expect that this is an optimization that the JS engine is
> interested in doing internally too, for things like Array.concat etc.

It is and they do.  It's a pretty subtle optimization, though, and easy 
to get wrong.  Even easier to become wrong later.

-Boris
Received on Monday, 18 November 2013 20:24:26 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:19 UTC