2021年1月20日星期三

Benchmark a custom http client

I have a custom rest client whose implementation is irrelevant for this question. I want to test how fast is this client vs other clients, some which are available in the web and some which belong to my private company repo.

My question is, is the below BenchMark good enough to do this? Or is it incorrect? I will clarify again that my goal is not to test how much time does the server takes to replay to me, but rather if my own code is fast enough.

func BenchmarkRestClientOK(b *testing.B) {      var restClient = NewRestClient()      // run the Fib function b.N times      for n := 0; n < b.N; n++ {          restClient.Request("GET", "https://jsonplaceholder.typicode.com/users/1", nil, nil, 3000, "")      }  }  
https://stackoverflow.com/questions/65820120/benchmark-a-custom-http-client January 21, 2021 at 09:51AM

没有评论:

发表评论