Skip to content

How to clear an IntervalHeap for re-use? #155

@mastef

Description

@mastef

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions