@@ -25,6 +25,7 @@ import (
2525
2626func BenchmarkGRPCSingleConnectionCPU (b * testing.B ) {
2727 srvEndpoint := setupServer (b , "cpu" )
28+ b .ResetTimer ()
2829
2930 // we share a single connection among all client goroutines
3031 cli , closeF := setupClient (b , srvEndpoint )
@@ -42,6 +43,7 @@ func BenchmarkGRPCSingleConnectionCPU(b *testing.B) {
4243
4344func BenchmarkGRPCMultiConnectionCPU (b * testing.B ) {
4445 srvEndpoint := setupServer (b , "cpu" )
46+ b .ResetTimer ()
4547
4648 b .RunParallel (func (pb * testing.PB ) {
4749 // each goroutine gets its own client + connection
@@ -62,10 +64,10 @@ func BenchmarkGRPCMultiConnectionCPU(b *testing.B) {
6264
6365func BenchmarkGRPCSingleConnectionECDSA (b * testing.B ) {
6466 srvEndpoint := setupServer (b , "ecdsa" )
67+ b .ResetTimer ()
68+
6569 cli , closeF := setupClient (b , srvEndpoint )
6670 defer closeF ()
67-
68- b .ResetTimer ()
6971 b .RunParallel (func (pb * testing.PB ) {
7072 for pb .Next () {
7173 resp , err := cli .CallViewWithContext (b .Context (), "fid" , nil )
@@ -78,8 +80,8 @@ func BenchmarkGRPCSingleConnectionECDSA(b *testing.B) {
7880
7981func BenchmarkGRPCMultiConnectionECDSA (b * testing.B ) {
8082 srvEndpoint := setupServer (b , "ecdsa" )
81-
8283 b .ResetTimer ()
84+
8385 b .RunParallel (func (pb * testing.PB ) {
8486 cli , closeF := setupClient (b , srvEndpoint )
8587 defer closeF ()
0 commit comments