Skip to content

Commit 6903ca5

Browse files
committed
Update benchmarks
1 parent c66f190 commit 6903ca5

File tree

2 files changed

+17
-18
lines changed

2 files changed

+17
-18
lines changed

README.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,14 @@ HOW TO USE
3333
➜ message-bus git:(master) ✗ go test -bench=. -cpu=4 -benchmem
3434
goos: darwin
3535
goarch: amd64
36-
pkg: github.com/vardius/message-bus
37-
BenchmarkWorkerNumCPU-4 500000 2321 ns/op 48 B/op 2 allocs/op
38-
BenchmarkWorkerNumCPUParallel-4 1000000 1595 ns/op 48 B/op 2 allocs/op
39-
BenchmarkWorker-4 100000 16878 ns/op 48 B/op 2 allocs/op
40-
BenchmarkWorkerParallel-4 100000 17454 ns/op 48 B/op 2 allocs/op
41-
BenchmarkWorker100-4 100000 16631 ns/op 48 B/op 2 allocs/op
42-
BenchmarkWorker100Parallel-4 100000 16793 ns/op 48 B/op 2 allocs/op
36+
BenchmarkBusNumCPU-4 500000 2565 ns/op 48 B/op 2 allocs/op
37+
BenchmarkBusNumCPUParallel-4 1000000 1682 ns/op 48 B/op 2 allocs/op
38+
BenchmarkBus-4 1000000 1105 ns/op 48 B/op 2 allocs/op
39+
BenchmarkBusParallel-4 2000000 955 ns/op 48 B/op 2 allocs/op
40+
BenchmarkBus100-4 100000 18328 ns/op 48 B/op 2 allocs/op
41+
BenchmarkBus100Parallel-4 100000 18369 ns/op 48 B/op 2 allocs/op
4342
PASS
44-
ok github.com/vardius/message-bus 10.350s
43+
ok message-bus 11.148s
4544
```
4645

4746
## Basic example

benchmark_test.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,42 +27,42 @@ func runParallel(b *testing.B, bus MessageBus) {
2727
})
2828
}
2929

30-
func BenchmarkWorkerNumCPU(b *testing.B) {
30+
func BenchmarkBusNumCPU(b *testing.B) {
3131
bus := New(runtime.NumCPU())
3232
addSubscribers(bus, runtime.NumCPU())
3333

3434
run(b, bus)
3535
}
3636

37-
func BenchmarkWorkerNumCPUParallel(b *testing.B) {
37+
func BenchmarkBusNumCPUParallel(b *testing.B) {
3838
bus := New(runtime.NumCPU())
3939
addSubscribers(bus, runtime.NumCPU())
4040

4141
runParallel(b, bus)
4242
}
4343

44-
func BenchmarkWorker(b *testing.B) {
45-
bus := New(100)
46-
addSubscribers(bus, 100)
44+
func BenchmarkBus(b *testing.B) {
45+
bus := New(1)
46+
addSubscribers(bus, 1)
4747

4848
run(b, bus)
4949
}
5050

51-
func BenchmarkWorkerParallel(b *testing.B) {
52-
bus := New(100)
53-
addSubscribers(bus, 100)
51+
func BenchmarkBusParallel(b *testing.B) {
52+
bus := New(1)
53+
addSubscribers(bus, 1)
5454

5555
runParallel(b, bus)
5656
}
5757

58-
func BenchmarkWorker100(b *testing.B) {
58+
func BenchmarkBus100(b *testing.B) {
5959
bus := New(100)
6060
addSubscribers(bus, 100)
6161

6262
run(b, bus)
6363
}
6464

65-
func BenchmarkWorker100Parallel(b *testing.B) {
65+
func BenchmarkBus100Parallel(b *testing.B) {
6666
bus := New(100)
6767
addSubscribers(bus, 100)
6868

0 commit comments

Comments
 (0)