Skip to content

set Iter method is expensive for large sets #19

@rickb777

Description

@rickb777

Because the set Iter method copies the keys into a slice, it will perform poorly for large sets, requiring a larger memory footprint and taking time to make the copy.

It may be possible to have a rangeable sequence generator that 'eats' the input set by using range to take one value at a time, immediately delete that value from the set, and return that value via the Val() T method. This would trade off the reduction in memory footprint against the need to drain the set to empty. In some cases, this might be preferable.

The method providing this behaviour might be called LazyIter to indicate its difference from the existing Iter method.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions