Skip to content

atomic.CompareAndSwap slower than mutexes #17604

@claygod

Description

@claygod

To "lock / free", I tried to use "atomic.CompareAndSwap" and "mutex". To my surprise, in a non-parallel use of "mutex" I was faster. Explain why "mutex" faster, because he uses "atomic.CompareAndSwap"?


  • What version of Go are you using (go version)? 1.7
  • What operating system and processor architecture are you using (go env)? Win7/i3

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions