Skip to content

Commit

Permalink
Update benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
vardius committed Feb 2, 2019
1 parent c66f190 commit 6903ca5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 18 deletions.
15 changes: 7 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,14 @@ HOW TO USE
➜ message-bus git:(master) ✗ go test -bench=. -cpu=4 -benchmem
goos: darwin
goarch: amd64
pkg: github.com/vardius/message-bus
BenchmarkWorkerNumCPU-4 500000 2321 ns/op 48 B/op 2 allocs/op
BenchmarkWorkerNumCPUParallel-4 1000000 1595 ns/op 48 B/op 2 allocs/op
BenchmarkWorker-4 100000 16878 ns/op 48 B/op 2 allocs/op
BenchmarkWorkerParallel-4 100000 17454 ns/op 48 B/op 2 allocs/op
BenchmarkWorker100-4 100000 16631 ns/op 48 B/op 2 allocs/op
BenchmarkWorker100Parallel-4 100000 16793 ns/op 48 B/op 2 allocs/op
BenchmarkBusNumCPU-4 500000 2565 ns/op 48 B/op 2 allocs/op
BenchmarkBusNumCPUParallel-4 1000000 1682 ns/op 48 B/op 2 allocs/op
BenchmarkBus-4 1000000 1105 ns/op 48 B/op 2 allocs/op
BenchmarkBusParallel-4 2000000 955 ns/op 48 B/op 2 allocs/op
BenchmarkBus100-4 100000 18328 ns/op 48 B/op 2 allocs/op
BenchmarkBus100Parallel-4 100000 18369 ns/op 48 B/op 2 allocs/op
PASS
ok github.com/vardius/message-bus 10.350s
ok message-bus 11.148s
```

## Basic example
Expand Down
20 changes: 10 additions & 10 deletions benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,42 +27,42 @@ func runParallel(b *testing.B, bus MessageBus) {
})
}

func BenchmarkWorkerNumCPU(b *testing.B) {
func BenchmarkBusNumCPU(b *testing.B) {
bus := New(runtime.NumCPU())
addSubscribers(bus, runtime.NumCPU())

run(b, bus)
}

func BenchmarkWorkerNumCPUParallel(b *testing.B) {
func BenchmarkBusNumCPUParallel(b *testing.B) {
bus := New(runtime.NumCPU())
addSubscribers(bus, runtime.NumCPU())

runParallel(b, bus)
}

func BenchmarkWorker(b *testing.B) {
bus := New(100)
addSubscribers(bus, 100)
func BenchmarkBus(b *testing.B) {
bus := New(1)
addSubscribers(bus, 1)

run(b, bus)
}

func BenchmarkWorkerParallel(b *testing.B) {
bus := New(100)
addSubscribers(bus, 100)
func BenchmarkBusParallel(b *testing.B) {
bus := New(1)
addSubscribers(bus, 1)

runParallel(b, bus)
}

func BenchmarkWorker100(b *testing.B) {
func BenchmarkBus100(b *testing.B) {
bus := New(100)
addSubscribers(bus, 100)

run(b, bus)
}

func BenchmarkWorker100Parallel(b *testing.B) {
func BenchmarkBus100Parallel(b *testing.B) {
bus := New(100)
addSubscribers(bus, 100)

Expand Down

0 comments on commit 6903ca5

Please sign in to comment.