You are correct, I apologize. I will note, that `undefined` assignment is faster than deletion. I wasn't able to get a good/consistent memory profile for comparison. I was mistaken about how Array is implemented from a couple articles that I'd read, the impression was slice would only effect the starting index and the number of items in the array affected, not the entire series.
Depending on how big the queue might get, it might be worth exploring using a linked-list instead of object refs.
https://github.com/tracker1/queue-testing
I don't agree... in FF, the feature was always half baked and hidden... I actually want more/better support for PWAs. Been using Edge a lot more lately, and my biggest complaint is that the "Install This Site As An App" option doesn't set it to it's own instance by default. Some sites can request to become an app, and that seems to work though the header at the top is confusing and probably shouldn't be there.
Even then, the most common use of the feature is with mobile devices.
It shouldn't go away, it's the best counter to app store censorship.
Then use splice if you're really concerned about it... will be O(n) with an n of 2.
Also, have you actually measured the performance cost of Delete... as I mentioned, you're optimizing by using an expensive call.
I'm not sure why one would do this over simply using an array... Delete in particular is a somewhat costly execution penalty.
class Queue {
constructor() {
this._items = [];
}
enqueue(item) {
this._items.push(item);
}
dequeue() {
return this._items.shift();
}
peek() {
return this._items[0];
}
get length() {
return this._items.length;
}
}