Skip to content

map: use batch lookups in Map.Iterate() #1079

@ti-mo

Description

@ti-mo

I would like to discuss the future of the Map Iterator API. Currently, it doesn't transparently use batch lookups under the hood
However, the current batch API, as it is in the library, is relatively barebones, and it hasn't been iterated on since its inception or integrated with other parts of the Map API.

Maybe it could be an option to either break the API of the current Map.Iterate() (and make it take a config struct),
or introduce a new Map.Range() or Map.For() method that takes a configuration struct. Or maybe simply Map.IterateBatch(), but that sounds rather unimaginative.

Ideally, we'd have a unified API where the caller can disable batch lookups if needed for certain use cases. Thinking
of hash map clearing where each call to .Next() is expected to point at the first element, which gets subsequently deleted.

Wondering if anyone's thought about this before, or if there's any opinions around this. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions