Skip to content

Instantly share code, notes, and snippets.

@quii
Last active August 29, 2015 14:17
Show Gist options
  • Save quii/7adf3a52002dc9df581b to your computer and use it in GitHub Desktop.
Save quii/7adf3a52002dc9df581b to your computer and use it in GitHub Desktop.
func Benchmark_the_stitcher(b *testing.B) {
slowHelloAPI := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
time.Sleep(500 * time.Millisecond)
fmt.Fprint(w, "Hello")
}))
slowWorldAPI := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
time.Sleep(500 * time.Millisecond)
fmt.Fprint(w, "world")
}))
b.ResetTimer()
for i := 0; i < b.N; i++ {
Stitcher(slowHelloAPI.URL, slowWorldAPI.URL)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment