Echo JS 0.11.0


panzerdp comments

panzerdp 904 days ago. link 3 points
I did a good thing a while ago: just stopped using Reddit.
panzerdp 1179 days ago. link 2 points
It would be great to see the memory usage of each approach.
panzerdp 1180 days ago. link 1 point
Thanks for comparing the different implementations! Yeah, clearly the SplicingQueue is the slowest.
panzerdp 1183 days ago. link 1 point
"Then use splice if you're really concerned about it... will be O(n) with an n of 2."

enqueue() and dequeue() operations on a queue have to be O(1) time complexity. Using unshift(), splice() is a mistake, they are O(n).

Your proposal is to use an O(n) complexity function splice() instead of delete O(1) - but that's just a mistake.

"Also, have you actually measured the performance cost of Delete... as I mentioned, you're optimizing by using an expensive call."

delete operator is O(1) time complexity. That's all that matters.

If you are concerned about the delete operator performance (which in 99% you shouldn't be), use a Map instead of a plan JavaScript object, then use map.delete(key).
panzerdp 1186 days ago. link 1 point
this._items.shift() cannot be used because it's O(n) time complexity.
panzerdp 1248 days ago. link 1 point
"Neither the original article [...] references any proposal to add this to the EcmaScript spec."

Plain wrong. Please go read the post again. It mentions: "Fortunately, a new proposal (at stage 3 as of January 2021) brings the method at() to arrays."

"but they want permission to "Act on my behalf" in Github"

Please go read about commenting system. "Act on my behalf" means that you allow Utterances app to comment in GitHub issues, but only in repositories that have installed Utterances app.
panzerdp 1346 days ago. link 1 point
Don't mix oranges with orange juice.

The post's sole purpose is to explain iterators in the most the accessible way. Generators are deliberately omitted because they're too complex, and, if mentioned, would introduce confusion to the reader.
panzerdp 1746 days ago. link 1 point
Good idea. You will find this message in the conclusion of the post too.