============================================================================= COMBINED BENCHMARKS ============================================================================= BenchmarkPoolAndPubSubMixed benchmarks mixed pool stats and PubSub operations
(b *testing.B)
| 320 | |
| 321 | // BenchmarkPoolAndPubSubMixed benchmarks mixed pool stats and PubSub operations |
| 322 | func BenchmarkPoolAndPubSubMixed(b *testing.B) { |
| 323 | ctx := context.Background() |
| 324 | client := benchmarkClient(32) |
| 325 | defer client.Close() |
| 326 | |
| 327 | b.ResetTimer() |
| 328 | b.ReportAllocs() |
| 329 | |
| 330 | b.RunParallel(func(pb *testing.PB) { |
| 331 | for pb.Next() { |
| 332 | // Mix of pool stats collection and PubSub creation |
| 333 | if pb.Next() { |
| 334 | // Pool stats operation |
| 335 | stats := client.PoolStats() |
| 336 | _ = stats.Hits + stats.Misses // Use the stats to prevent optimization |
| 337 | } |
| 338 | |
| 339 | if pb.Next() { |
| 340 | // PubSub operation |
| 341 | pubsub := client.Subscribe(ctx, "test-channel") |
| 342 | pubsub.Close() |
| 343 | } |
| 344 | } |
| 345 | }) |
| 346 | } |
| 347 | |
| 348 | // BenchmarkPoolStatsCollection benchmarks pool statistics collection |
| 349 | func BenchmarkPoolStatsCollection(b *testing.B) { |
nothing calls this directly
no test coverage detected