summaryrefslogtreecommitdiff
path: root/pkg/pool
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2021-07-22 15:47:31 +0300
committerValery Piashchynski <[email protected]>2021-07-22 15:47:31 +0300
commit6561c6a0d5c918d09d792fb4c70629b5dd3a2f0d (patch)
tree53f5cc60e07bbc464d49b1a2efe08ca22af1ffcd /pkg/pool
parentae2bdd71874c0714f476a945ab805e0eb4b532ae (diff)
Update Echo bench
Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'pkg/pool')
-rwxr-xr-xpkg/pool/static_pool_test.go16
1 files changed, 15 insertions, 1 deletions
diff --git a/pkg/pool/static_pool_test.go b/pkg/pool/static_pool_test.go
index 705f6bfe..3eec34d0 100755
--- a/pkg/pool/static_pool_test.go
+++ b/pkg/pool/static_pool_test.go
@@ -564,6 +564,12 @@ func Test_Static_Pool_WrongCommand2(t *testing.T) {
assert.Nil(t, p)
}
+// PTR:
+// Benchmark_Pool_Echo-32 49076 29926 ns/op 8016 B/op 20 allocs/op
+// Benchmark_Pool_Echo-32 47257 30779 ns/op 8047 B/op 20 allocs/op
+// Benchmark_Pool_Echo-32 46737 29440 ns/op 8065 B/op 20 allocs/op
+// Benchmark_Pool_Echo-32 51177 29074 ns/op 7981 B/op 20 allocs/op
+// Benchmark_Pool_Echo-32 51764 28319 ns/op 8012 B/op 20 allocs/op
func Benchmark_Pool_Echo(b *testing.B) {
ctx := context.Background()
p, err := Initialize(
@@ -576,10 +582,18 @@ func Benchmark_Pool_Echo(b *testing.B) {
b.Fatal(err)
}
+ bd := make([]byte, 1024)
+ c := make([]byte, 1024)
+
+ pld := &payload.Payload{
+ Context: c,
+ Body: bd,
+ }
+
b.ResetTimer()
b.ReportAllocs()
for n := 0; n < b.N; n++ {
- if _, err := p.Exec(&payload.Payload{Body: []byte("hello")}); err != nil {
+ if _, err := p.Exec(pld); err != nil {
b.Fail()
}
}