Skip to content

Commit

Permalink
README: more benchmark info
Browse files Browse the repository at this point in the history
  • Loading branch information
neilotoole committed Jan 19, 2024
1 parent e972696 commit e18fb22
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,16 @@ The benchmarks compare three mutex implementations:
[`semaphore.Weighted`](https://pkg.go.dev/golang.org/x/sync/semaphore); it
exists only in the test code, as a comparison baseline.

What conclusions can be drawn from the results below? Well, `fifomu.Mutex`
is always at least 1.5x slower than `sync.Mutex`, and often more. The
worst results are in `BenchmarkMutexSpin`, where `fifomu.Mutex` is 10x slower
than `sync.Mutex`.

Benchmark your own workload before committing to `fifomu.Mutex`. In many
cases you will be able to design around the need for FIFO lock acquisition.
It's a bit of a code smell to begin with, but sometimes it's the most
straightforward solution.

```
$ GOMAXPROCS=10 go test -bench .
goos: darwin
Expand Down

0 comments on commit e18fb22

Please sign in to comment.