Skip to content

Lock congestion when the same interned value is used in a hot function #970

@MichaReiser

Description

@MichaReiser

This is something that has come up in ty, see astral-sh/ty#968

If there's a hot function that calls new on very few interned values (let's say two!), then the threads start blocking each other because intern_id uses a Mutex sharded by value.

We could consider using a RwLock but that comes at the cost that the cold path (a new value or a value that hasn't been interned yet) becomes more expensive.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions