Skip to content

Extend HashTable's bucket API to support insertion ? #723

@eggyal

Description

@eggyal

When one wishes to "get or insert" from/into a HashTable that is behind a RwLock, one typically first attempts to "get" with only a read lock (via the .find API), and only if that fails fallback to a "get or insert" with a write lock (via the .entry API).

However, the .entry call repeats the probing that was undertaken during the .find call: this is necessary because the table could have been modified between release of the read lock and acquisition of the write lock.

But in some cases, one might be able to determine whether the table was modified in the interim and thus avoid such duplicate probing. For example, if the table is append-only and its length has not changed.

The new bucket API almost exposes such an ability, but not quite. Is there any interest it being extended to support this use case, or is this perhaps too niche for hashbrown?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions