File tree Expand file tree Collapse file tree 2 files changed +17
-18
lines changed Expand file tree Collapse file tree 2 files changed +17
-18
lines changed Original file line number Diff line number Diff line change @@ -33,15 +33,14 @@ HOW TO USE
33
33
➜ message-bus git:(master) ✗ go test -bench=. -cpu=4 -benchmem
34
34
goos: darwin
35
35
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
43
42
PASS
44
- ok github.com/vardius/ message-bus 10.350s
43
+ ok message-bus 11.148s
45
44
```
46
45
47
46
## Basic example
Original file line number Diff line number Diff line change @@ -27,42 +27,42 @@ func runParallel(b *testing.B, bus MessageBus) {
27
27
})
28
28
}
29
29
30
- func BenchmarkWorkerNumCPU (b * testing.B ) {
30
+ func BenchmarkBusNumCPU (b * testing.B ) {
31
31
bus := New (runtime .NumCPU ())
32
32
addSubscribers (bus , runtime .NumCPU ())
33
33
34
34
run (b , bus )
35
35
}
36
36
37
- func BenchmarkWorkerNumCPUParallel (b * testing.B ) {
37
+ func BenchmarkBusNumCPUParallel (b * testing.B ) {
38
38
bus := New (runtime .NumCPU ())
39
39
addSubscribers (bus , runtime .NumCPU ())
40
40
41
41
runParallel (b , bus )
42
42
}
43
43
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 )
47
47
48
48
run (b , bus )
49
49
}
50
50
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 )
54
54
55
55
runParallel (b , bus )
56
56
}
57
57
58
- func BenchmarkWorker100 (b * testing.B ) {
58
+ func BenchmarkBus100 (b * testing.B ) {
59
59
bus := New (100 )
60
60
addSubscribers (bus , 100 )
61
61
62
62
run (b , bus )
63
63
}
64
64
65
- func BenchmarkWorker100Parallel (b * testing.B ) {
65
+ func BenchmarkBus100Parallel (b * testing.B ) {
66
66
bus := New (100 )
67
67
addSubscribers (bus , 100 )
68
68
You can’t perform that action at this time.
0 commit comments