Created
September 16, 2016 18:29
-
-
Save appleby/4e1fa434485084ed71c1ff3cec17cbe3 to your computer and use it in GitHub Desktop.
Benchmark results for patch set 1 of https://go-review.googlesource.com/#/c/29243/1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [ma@march benchcmp]? benchcmp http2-req-orig.txt http2-req-patch-set-1.txt | |
| benchmark old ns/op new ns/op delta | |
| BenchmarkClientRequestHeaders/___0_Headers-4 253637 256495 +1.13% | |
| BenchmarkClientRequestHeaders/__10_Headers-4 302833 307072 +1.40% | |
| BenchmarkClientRequestHeaders/_100_Headers-4 771251 773099 +0.24% | |
| BenchmarkClientRequestHeaders/1000_Headers-4 7970480 8012981 +0.53% | |
| benchmark old allocs new allocs delta | |
| BenchmarkClientRequestHeaders/___0_Headers-4 53 57 +7.55% | |
| BenchmarkClientRequestHeaders/__10_Headers-4 85 90 +5.88% | |
| BenchmarkClientRequestHeaders/_100_Headers-4 368 376 +2.17% | |
| BenchmarkClientRequestHeaders/1000_Headers-4 5138 5145 +0.14% | |
| benchmark old bytes new bytes delta | |
| BenchmarkClientRequestHeaders/___0_Headers-4 4493 5113 +13.80% | |
| BenchmarkClientRequestHeaders/__10_Headers-4 6126 7397 +20.75% | |
| BenchmarkClientRequestHeaders/_100_Headers-4 29300 39969 +36.41% | |
| BenchmarkClientRequestHeaders/1000_Headers-4 338151 431371 +27.57% |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func benchSimpleRoundTrip(b *testing.B, nHeaders int) { | |
| defer disableGoroutineTracking()() | |
| b.ReportAllocs() | |
| st := newServerTester(b, | |
| func(w http.ResponseWriter, r *http.Request) { | |
| }, | |
| optOnlyServer, | |
| optQuiet, | |
| ) | |
| defer st.Close() | |
| tr := &Transport{TLSClientConfig: tlsConfigInsecure} | |
| defer tr.CloseIdleConnections() | |
| req, err := http.NewRequest("GET", st.ts.URL, nil) | |
| if err != nil { | |
| b.Fatal(err) | |
| } | |
| for i := 0; i < nHeaders; i++ { | |
| name := fmt.Sprint("A-", i) | |
| req.Header.Set(name, "*") | |
| } | |
| b.ResetTimer() | |
| for i := 0; i < b.N; i++ { | |
| res, err := tr.RoundTrip(req) | |
| if err != nil { | |
| if res != nil { | |
| res.Body.Close() | |
| } | |
| b.Fatalf("RoundTrip err = %v; want nil", err) | |
| } | |
| res.Body.Close() | |
| if res.StatusCode != http.StatusOK { | |
| b.Fatalf("Response code = %v; want %v", res.StatusCode, http.StatusOK) | |
| } | |
| } | |
| } | |
| func BenchmarkClientRequestHeaders(b *testing.B) { | |
| b.Run(" 0 Headers", func(b *testing.B) { benchSimpleRoundTrip(b, 0) }) | |
| b.Run(" 10 Headers", func(b *testing.B) { benchSimpleRoundTrip(b, 10) }) | |
| b.Run(" 100 Headers", func(b *testing.B) { benchSimpleRoundTrip(b, 100) }) | |
| b.Run("1000 Headers", func(b *testing.B) { benchSimpleRoundTrip(b, 1000) }) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment