You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi!
I noticed that you only reduce this.length in pop() and clear(), but don't actually update ids. That means if I store large objects (e.g. DOM nodes) in the queue, they might not get garbage collected even if my code has no other references to them.
I don't know what the performance impact would be to always shrink ids. In any case, it should be safe to assign undefined to the unused indexes.
The text was updated successfully, but these errors were encountered:
Yes, this was an intentional change — see #1. I should probably add a note about this in the docs. There's also a shrink method that shrinks the arrays manually. Assigning undefined might have performance implications in case FlatQueue is used with numerical values since v8 and other JS engines heavily optimize numerical arrays and switch to "slow" mode whenever there's a hole or non-numerical value.
Hi!
I noticed that you only reduce
this.length
inpop()
andclear()
, but don't actually updateids
. That means if I store large objects (e.g. DOM nodes) in the queue, they might not get garbage collected even if my code has no other references to them.I don't know what the performance impact would be to always shrink
ids
. In any case, it should be safe to assignundefined
to the unused indexes.The text was updated successfully, but these errors were encountered: