Skip to content

automatic shrinking of hash table capacity is very expensive #17645

Closed
@thestinger

Description

@thestinger

This interacts poorly with with_capacity since it will just end up shrinking the allocation immediately. It's very widely used since FromIter uses it with the iterator size hint. Even in code that's not pre-allocating capacity, the resize strategy results in many reallocations as the hash table shrinks and then grows again. Allocator improvements are possible but this is always going to be extremely expensive for huge collections on most platforms.

Metadata

Metadata

Assignees

No one assigned

    Labels

    I-slowIssue: Problems and improvements with respect to performance of generated code.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions