Skip to content

math/rand: use a sharded lock for the default shared Source #20387

Closed
@ianlancetaylor

Description

@ianlancetaylor

Benchmarks and performance sensitive code that use the top-level functions in the math/rand package (rand.Intn and so forth) will have hidden lock contention on the default shared Source. This can be a surprise to people, as they see unexpectedly poor performance without realizing clearly that the problem is in their code.. If we had a sharded lock of some sort, this would be a good place to use it.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions