Queue Feature Request
fpizlo at apple.com
Sun Feb 26 01:10:26 UTC 2017
In WebKit the array implementation switches to an amortized constant time deque if you use push/pop/shift/unshift in anger. So, a program that just treats arrays as if they were deques should perform great. If you find that it does not perform as well as you would like, then we would love to hear a bug report at bugs.webkit.org.
I think that adding a Deque type is an OK idea. But maybe it's better if all of the implementations get adaptive arrays right.
> On Feb 25, 2017, at 15:03, Zach Boldyga <zach at scalabull.com> wrote:
> Sorry if this is an ignorant request, I scanned the proposals and didn't see anything that appeared similar.
> Is it appropriate for ECMAScript to include a Queue implementation, or adjust shifting to a constant amortized time operation? Server-side usage of the language is mostly formidable nowadays, and I've run into cases where it would have been convenient to have an in-language queue.
> I see in the latest Array.prototype.shift documentation (https://tc39.github.io/ecma262/#sec-array.prototype.shift) that shift is still intended to be an O(n) operation, meaning those wanting to implement a proper queue may need to rely on external libraries, like this one: https://github.com/petkaantonov/deque .
> As the github link mentions, V8 has a trick to get around array resizing, but for serious users we still need to rely on an external library. It'd be great if this was a built-in feature.
> I'm sure someone has looked at this before - what do you think?
> Zach Boldyga
> Scalabull | Founder
> 1 (866) 846-8771 x 101
> es-discuss mailing list
> es-discuss at mozilla.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss