From ae2bdd71874c0714f476a945ab805e0eb4b532ae Mon Sep 17 00:00:00 2001 From: Valery Piashchynski Date: Thu, 22 Jul 2021 15:42:45 +0300 Subject: Update static_pool_batched test Signed-off-by: Valery Piashchynski --- pkg/pool/static_pool_test.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'pkg') diff --git a/pkg/pool/static_pool_test.go b/pkg/pool/static_pool_test.go index c57b1683..705f6bfe 100755 --- a/pkg/pool/static_pool_test.go +++ b/pkg/pool/static_pool_test.go @@ -586,6 +586,8 @@ func Benchmark_Pool_Echo(b *testing.B) { } // Benchmark_Pool_Echo_Batched-32 366996 2873 ns/op 1233 B/op 24 allocs/op +// PTR -> Benchmark_Pool_Echo_Batched-32 406839 2900 ns/op 1059 B/op 23 allocs/op +// PTR -> Benchmark_Pool_Echo_Batched-32 413312 2904 ns/op 1067 B/op 23 allocs/op func Benchmark_Pool_Echo_Batched(b *testing.B) { ctx := context.Background() p, err := Initialize( @@ -601,12 +603,23 @@ func Benchmark_Pool_Echo_Batched(b *testing.B) { assert.NoError(b, err) defer p.Destroy(ctx) + bd := make([]byte, 1024) + c := make([]byte, 1024) + + pld := &payload.Payload{ + Context: c, + Body: bd, + } + + b.ResetTimer() + b.ReportAllocs() + var wg sync.WaitGroup for i := 0; i < b.N; i++ { wg.Add(1) go func() { defer wg.Done() - if _, err := p.Exec(&payload.Payload{Body: []byte("hello")}); err != nil { + if _, err := p.Exec(pld); err != nil { b.Fail() log.Println(err) } -- cgit v1.2.3