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
It would be nice to be able to clear an IntervalHeap for re-use, to reduce array allocs and to avoid GC.
Currently ( if I understood correctly ) it can be only cleared with running either while (!iHeap.IsEmpty) iHeap.DeleteMin(); or while (!iHeap.IsEmpty) iHeap.DeleteMax();, which seems less than optimal performance wise.
A iHeap.Clear() method could Array.Clear(heap, 0, size); and then set size = 0
The text was updated successfully, but these errors were encountered:
I've been testing now with this, and it seems to work nicely. It reduced a lot of GC by allowing to re-use interval heaps without having to create a new one:
It would be nice to be able to clear an IntervalHeap for re-use, to reduce array allocs and to avoid GC.
Currently ( if I understood correctly ) it can be only cleared with running either
while (!iHeap.IsEmpty) iHeap.DeleteMin();
orwhile (!iHeap.IsEmpty) iHeap.DeleteMax();
, which seems less than optimal performance wise.A
iHeap.Clear()
method couldArray.Clear(heap, 0, size);
and then setsize = 0
The text was updated successfully, but these errors were encountered: