Implementations aren't required to follow exactly these steps, just to have the same result.
On 29/03/17 17:15, Daniel Herman wrote: > In reading the relevant section for the `size` accessors > (http://www.ecma-international.org/ecma-262/7.0/index.html#sec-get-map.prototype.size > <http://www.ecma-international.org/ecma-262/7.0/index.html#sec-get-map.prototype.size>), > I'm confused and wondering why this was defined as an O(n) operation > in the `get` accessor rather than as an additional step in the `set`, > `delete`, and `clear` methods to track an internal `[[Size]]` variable > or something, making the public `size` accessor capable of being O(1). > > It seems surprising to me that in order to be spec compliant, Map and > Set implementations must implement accessors that have surprising perf > implications. > > > _______________________________________________ > 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

