{"action":"created","comment":{"url":"https://api.github.com/repos/yarpc/yarpc-go/pulls/comments/74110489","id":74110489,"diff_hunk":"@@ -0,0 +1,251 @@\n+package yarpc_test\n+\n+import (\n+\t\"bytes\"\n+\t\"io\"\n+\t\"io/ioutil\"\n+\t\"net/http\"\n+\t\"testing\"\n+\t\"time\"\n+\n+\t\"github.com/yarpc/yarpc-go\"\n+\t\"github.com/yarpc/yarpc-go/encoding/raw\"\n+\t\"github.com/yarpc/yarpc-go/transport\"\n+\tyhttp \"github.com/yarpc/yarpc-go/transport/http\"\n+\tytchannel \"github.com/yarpc/yarpc-go/transport/tchannel\"\n+\n+\t\"github.com/stretchr/testify/assert\"\n+\t\"github.com/stretchr/testify/require\"\n+\t\"github.com/uber/tchannel-go\"\n+\ttraw \"github.com/uber/tchannel-go/raw\"\n+\t\"golang.org/x/net/context\"\n+\t\"golang.org/x/net/context/ctxhttp\"\n+)\n+\n+var _reqBody = []byte(\"hello\")\n+\n+func yarpcEcho(reqMeta yarpc.ReqMeta, body []byte) ([]byte, yarpc.ResMeta, error) {\n+\treturn body, yarpc.NewResMeta(reqMeta.Context()).Headers(reqMeta.Headers()), nil\n+}\n+\n+func httpEcho(t testing.TB) http.HandlerFunc {\n+\treturn func(w http.ResponseWriter, r *http.Request) {\n+\t\tdefer r.Body.Close()\n+\t\ths := w.Header()\n+\t\tfor k, vs := range r.Header {\n+\t\t\tfor _, v := range vs {\n+\t\t\t\ths.Set(k, v)\n+\t\t\t}\n+\t\t}\n+\n+\t\t_, err := io.Copy(w, r.Body)\n+\t\tassert.NoError(t, err, \"failed to write HTTP response body\")\n+\t}\n+}\n+\n+type tchannelEcho struct{ t testing.TB }\n+\n+func (tchannelEcho) Handle(ctx context.Context, args *traw.Args) (*traw.Res, error) {\n+\treturn &traw.Res{Arg2: args.Arg2, Arg3: args.Arg3}, nil\n+}\n+\n+func (t tchannelEcho) OnError(ctx context.Context, err error) {\n+\tt.t.Fatalf(\"request failed: %v\", err)\n+}\n+\n+func withDispatcher(t testing.TB, cfg yarpc.Config, f func(yarpc.Dispatcher)) {\n+\td := yarpc.NewDispatcher(cfg)\n+\trequire.NoError(t, d.Start(), \"failed to start server\")\n+\tdefer d.Stop()\n+\n+\tf(d)\n+}\n+\n+func runYARPCClient(b *testing.B, c raw.Client) {\n+\tfor i := 0; i < b.N; i++ {\n+\t\tctx, _ := context.WithTimeout(context.Background(), 100*time.Millisecond)\n+\t\t_, _, err := c.Call(yarpc.NewReqMeta(ctx).Procedure(\"echo\"), _reqBody)\n+\t\trequire.NoError(b, err, \"request %d failed\", i+1)\n+\t}\n+}\n+\n+func runHTTPClient(b *testing.B, c *http.Client, url string) {\n+\tfor i := 0; i < b.N; i++ {\n+\t\tctx, _ := context.WithTimeout(context.Background(), 100*time.Millisecond)\n+\t\treq, err := http.NewRequest(\"POST\", url, bytes.NewReader(_reqBody))\n+\t\trequire.NoError(b, err, \"failed to build request %d\", i+1)\n+\n+\t\treq.Header.Add(\"Rpc-Caller\", \"http-client\")\n+\t\treq.Header.Add(\"Rpc-Encoding\", \"raw\")\n+\t\treq.Header.Add(\"Context-TTL-MS\", \"100\")","path":"bench_test.go","position":80,"original_position":80,"commit_id":"c9499fbac0b945eaacd96f02ece1c35f7338c84d","original_commit_id":"c9499fbac0b945eaacd96f02ece1c35f7338c84d","user":{"login":"breerly","id":263587,"avatar_url":"https://avatars.githubusercontent.com/u/263587?v=3","gravatar_id":"","url":"https://api.github.com/users/breerly","html_url":"https://github.com/breerly","followers_url":"https://api.github.com/users/breerly/followers","following_url":"https://api.github.com/users/breerly/following{/other_user}","gists_url":"https://api.github.com/users/breerly/gists{/gist_id}","starred_url":"https://api.github.com/users/breerly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/breerly/subscriptions","organizations_url":"https://api.github.com/users/breerly/orgs","repos_url":"https://api.github.com/users/breerly/repos","events_url":"https://api.github.com/users/breerly/events{/privacy}","received_events_url":"https://api.github.com/users/breerly/received_events","type":"User","site_admin":false},"body":"suggest moving this to the end so all the \"Rpc-\" headers can live together","created_at":"2016-08-09T17:56:36Z","updated_at":"2016-08-09T17:56:36Z","html_url":"https://github.com/yarpc/yarpc-go/pull/282#discussion_r74110489","pull_request_url":"https://api.github.com/repos/yarpc/yarpc-go/pulls/282","_links":{"self":{"href":"https://api.github.com/repos/yarpc/yarpc-go/pulls/comments/74110489"},"html":{"href":"https://github.com/yarpc/yarpc-go/pull/282#discussion_r74110489"},"pull_request":{"href":"https://api.github.com/repos/yarpc/yarpc-go/pulls/282"}}},"pull_request":{"url":"https://api.github.com/repos/yarpc/yarpc-go/pulls/282","id":80544214,"html_url":"https://github.com/yarpc/yarpc-go/pull/282","diff_url":"https://github.com/yarpc/yarpc-go/pull/282.diff","patch_url":"https://github.com/yarpc/yarpc-go/pull/282.patch","issue_url":"https://api.github.com/repos/yarpc/yarpc-go/issues/282","number":282,"state":"open","locked":false,"title":"Add basic benchmarks for HTTP/TChannel","user":{"login":"abhinav","id":41730,"avatar_url":"https://avatars.githubusercontent.com/u/41730?v=3","gravatar_id":"","url":"https://api.github.com/users/abhinav","html_url":"https://github.com/abhinav","followers_url":"https://api.github.com/users/abhinav/followers","following_url":"https://api.github.com/users/abhinav/following{/other_user}","gists_url":"https://api.github.com/users/abhinav/gists{/gist_id}","starred_url":"https://api.github.com/users/abhinav/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abhinav/subscriptions","organizations_url":"https://api.github.com/users/abhinav/orgs","repos_url":"https://api.github.com/users/abhinav/repos","events_url":"https://api.github.com/users/abhinav/events{/privacy}","received_events_url":"https://api.github.com/users/abhinav/received_events","type":"User","site_admin":false},"body":"This compares {net/http, tchannel-go, yarpc} to/from {net/http, tchannel-go, yarpc} for both protocols.\r\n\r\nResults on my laptop:\r\n\r\n```\r\n$ go test -bench=. -benchtime=15s -benchmem\r\nPASS\r\nBenchmark_HTTP_YARPCToYARPC-8          \t  300000\t     88716 ns/op\t    7515 B/op\t     107 allocs/op\r\nBenchmark_HTTP_YARPCToNetHTTP-8        \t  200000\t     95931 ns/op\t    8621 B/op\t     127 allocs/op\r\nBenchmark_HTTP_NetHTTPToYARPC-8        \t  300000\t     85768 ns/op\t    7343 B/op\t     106 allocs/op\r\nBenchmark_HTTP_NetHTTPToNetHTTP-8      \t  200000\t     89929 ns/op\t    8460 B/op\t     126 allocs/op\r\nBenchmark_TChannel_YARPCToYARPC-8      \t  300000\t     86087 ns/op\t   12787 B/op\t     132 allocs/op\r\nBenchmark_TChannel_YARPCToTChannel-8   \t  300000\t     80755 ns/op\t   12816 B/op\t     127 allocs/op\r\nBenchmark_TChannel_TChannelToYARPC-8   \t  200000\t     87658 ns/op\t   12995 B/op\t     126 allocs/op\r\nBenchmark_TChannel_TChannelToTChannel-8\t  300000\t     74435 ns/op\t   13028 B/op\t     121 allocs/op\r\nok  \tgithub.com/yarpc/yarpc-go\t186.535s\r\n```\r\n\r\nCC @prashantv @breerly @bombela","created_at":"2016-08-09T00:29:24Z","updated_at":"2016-08-09T17:56:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"365a841865579c52f920a6fb084e92f4bc60a7aa","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/yarpc/yarpc-go/pulls/282/commits","review_comments_url":"https://api.github.com/repos/yarpc/yarpc-go/pulls/282/comments","review_comment_url":"https://api.github.com/repos/yarpc/yarpc-go/pulls/comments{/number}","comments_url":"https://api.github.com/repos/yarpc/yarpc-go/issues/282/comments","statuses_url":"https://api.github.com/repos/yarpc/yarpc-go/statuses/c9499fbac0b945eaacd96f02ece1c35f7338c84d","head":{"label":"yarpc:benchmark","ref":"benchmark","sha":"c9499fbac0b945eaacd96f02ece1c35f7338c84d","user":{"login":"yarpc","id":16569504,"avatar_url":"https://avatars.githubusercontent.com/u/16569504?v=3","gravatar_id":"","url":"https://api.github.com/users/yarpc","html_url":"https://github.com/yarpc","followers_url":"https://api.github.com/users/yarpc/followers","following_url":"https://api.github.com/users/yarpc/following{/other_user}","gists_url":"https://api.github.com/users/yarpc/gists{/gist_id}","starred_url":"https://api.github.com/users/yarpc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yarpc/subscriptions","organizations_url":"https://api.github.com/users/yarpc/orgs","repos_url":"https://api.github.com/users/yarpc/repos","events_url":"https://api.github.com/users/yarpc/events{/privacy}","received_events_url":"https://api.github.com/users/yarpc/received_events","type":"Organization","site_admin":false},"repo":{"id":50390111,"name":"yarpc-go","full_name":"yarpc/yarpc-go","owner":{"login":"yarpc","id":16569504,"avatar_url":"https://avatars.githubusercontent.com/u/16569504?v=3","gravatar_id":"","url":"https://api.github.com/users/yarpc","html_url":"https://github.com/yarpc","followers_url":"https://api.github.com/users/yarpc/followers","following_url":"https://api.github.com/users/yarpc/following{/other_user}","gists_url":"https://api.github.com/users/yarpc/gists{/gist_id}","starred_url":"https://api.github.com/users/yarpc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yarpc/subscriptions","organizations_url":"https://api.github.com/users/yarpc/orgs","repos_url":"https://api.github.com/users/yarpc/repos","events_url":"https://api.github.com/users/yarpc/events{/privacy}","received_events_url":"https://api.github.com/users/yarpc/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/yarpc/yarpc-go","description":"YARPC for Golang","fork":false,"url":"https://api.github.com/repos/yarpc/yarpc-go","forks_url":"https://api.github.com/repos/yarpc/yarpc-go/forks","keys_url":"https://api.github.com/repos/yarpc/yarpc-go/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yarpc/yarpc-go/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yarpc/yarpc-go/teams","hooks_url":"https://api.github.com/repos/yarpc/yarpc-go/hooks","issue_events_url":"https://api.github.com/repos/yarpc/yarpc-go/issues/events{/number}","events_url":"https://api.github.com/repos/yarpc/yarpc-go/events","assignees_url":"https://api.github.com/repos/yarpc/yarpc-go/assignees{/user}","branches_url":"https://api.github.com/repos/yarpc/yarpc-go/branches{/branch}","tags_url":"https://api.github.com/repos/yarpc/yarpc-go/tags","blobs_url":"https://api.github.com/repos/yarpc/yarpc-go/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yarpc/yarpc-go/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yarpc/yarpc-go/git/refs{/sha}","trees_url":"https://api.github.com/repos/yarpc/yarpc-go/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yarpc/yarpc-go/statuses/{sha}","languages_url":"https://api.github.com/repos/yarpc/yarpc-go/languages","stargazers_url":"https://api.github.com/repos/yarpc/yarpc-go/stargazers","contributors_url":"https://api.github.com/repos/yarpc/yarpc-go/contributors","subscribers_url":"https://api.github.com/repos/yarpc/yarpc-go/subscribers","subscription_url":"https://api.github.com/repos/yarpc/yarpc-go/subscription","commits_url":"https://api.github.com/repos/yarpc/yarpc-go/commits{/sha}","git_commits_url":"https://api.github.com/repos/yarpc/yarpc-go/git/commits{/sha}","comments_url":"https://api.github.com/repos/yarpc/yarpc-go/comments{/number}","issue_comment_url":"https://api.github.com/repos/yarpc/yarpc-go/issues/comments{/number}","contents_url":"https://api.github.com/repos/yarpc/yarpc-go/contents/{+path}","compare_url":"https://api.github.com/repos/yarpc/yarpc-go/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yarpc/yarpc-go/merges","archive_url":"https://api.github.com/repos/yarpc/yarpc-go/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yarpc/yarpc-go/downloads","issues_url":"https://api.github.com/repos/yarpc/yarpc-go/issues{/number}","pulls_url":"https://api.github.com/repos/yarpc/yarpc-go/pulls{/number}","milestones_url":"https://api.github.com/repos/yarpc/yarpc-go/milestones{/number}","notifications_url":"https://api.github.com/repos/yarpc/yarpc-go/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yarpc/yarpc-go/labels{/name}","releases_url":"https://api.github.com/repos/yarpc/yarpc-go/releases{/id}","deployments_url":"https://api.github.com/repos/yarpc/yarpc-go/deployments","created_at":"2016-01-26T00:04:14Z","updated_at":"2016-07-28T02:25:48Z","pushed_at":"2016-08-09T17:38:23Z","git_url":"git://github.com/yarpc/yarpc-go.git","ssh_url":"git@github.com:yarpc/yarpc-go.git","clone_url":"https://github.com/yarpc/yarpc-go.git","svn_url":"https://github.com/yarpc/yarpc-go","homepage":"","size":6632,"stargazers_count":4,"watchers_count":4,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":32,"forks":0,"open_issues":32,"watchers":4,"default_branch":"master"}},"base":{"label":"yarpc:master","ref":"master","sha":"3a4561d3e198e36cabc726b2e2862fb1bb9e3fc3","user":{"login":"yarpc","id":16569504,"avatar_url":"https://avatars.githubusercontent.com/u/16569504?v=3","gravatar_id":"","url":"https://api.github.com/users/yarpc","html_url":"https://github.com/yarpc","followers_url":"https://api.github.com/users/yarpc/followers","following_url":"https://api.github.com/users/yarpc/following{/other_user}","gists_url":"https://api.github.com/users/yarpc/gists{/gist_id}","starred_url":"https://api.github.com/users/yarpc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yarpc/subscriptions","organizations_url":"https://api.github.com/users/yarpc/orgs","repos_url":"https://api.github.com/users/yarpc/repos","events_url":"https://api.github.com/users/yarpc/events{/privacy}","received_events_url":"https://api.github.com/users/yarpc/received_events","type":"Organization","site_admin":false},"repo":{"id":50390111,"name":"yarpc-go","full_name":"yarpc/yarpc-go","owner":{"login":"yarpc","id":16569504,"avatar_url":"https://avatars.githubusercontent.com/u/16569504?v=3","gravatar_id":"","url":"https://api.github.com/users/yarpc","html_url":"https://github.com/yarpc","followers_url":"https://api.github.com/users/yarpc/followers","following_url":"https://api.github.com/users/yarpc/following{/other_user}","gists_url":"https://api.github.com/users/yarpc/gists{/gist_id}","starred_url":"https://api.github.com/users/yarpc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yarpc/subscriptions","organizations_url":"https://api.github.com/users/yarpc/orgs","repos_url":"https://api.github.com/users/yarpc/repos","events_url":"https://api.github.com/users/yarpc/events{/privacy}","received_events_url":"https://api.github.com/users/yarpc/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/yarpc/yarpc-go","description":"YARPC for Golang","fork":false,"url":"https://api.github.com/repos/yarpc/yarpc-go","forks_url":"https://api.github.com/repos/yarpc/yarpc-go/forks","keys_url":"https://api.github.com/repos/yarpc/yarpc-go/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yarpc/yarpc-go/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yarpc/yarpc-go/teams","hooks_url":"https://api.github.com/repos/yarpc/yarpc-go/hooks","issue_events_url":"https://api.github.com/repos/yarpc/yarpc-go/issues/events{/number}","events_url":"https://api.github.com/repos/yarpc/yarpc-go/events","assignees_url":"https://api.github.com/repos/yarpc/yarpc-go/assignees{/user}","branches_url":"https://api.github.com/repos/yarpc/yarpc-go/branches{/branch}","tags_url":"https://api.github.com/repos/yarpc/yarpc-go/tags","blobs_url":"https://api.github.com/repos/yarpc/yarpc-go/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yarpc/yarpc-go/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yarpc/yarpc-go/git/refs{/sha}","trees_url":"https://api.github.com/repos/yarpc/yarpc-go/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yarpc/yarpc-go/statuses/{sha}","languages_url":"https://api.github.com/repos/yarpc/yarpc-go/languages","stargazers_url":"https://api.github.com/repos/yarpc/yarpc-go/stargazers","contributors_url":"https://api.github.com/repos/yarpc/yarpc-go/contributors","subscribers_url":"https://api.github.com/repos/yarpc/yarpc-go/subscribers","subscription_url":"https://api.github.com/repos/yarpc/yarpc-go/subscription","commits_url":"https://api.github.com/repos/yarpc/yarpc-go/commits{/sha}","git_commits_url":"https://api.github.com/repos/yarpc/yarpc-go/git/commits{/sha}","comments_url":"https://api.github.com/repos/yarpc/yarpc-go/comments{/number}","issue_comment_url":"https://api.github.com/repos/yarpc/yarpc-go/issues/comments{/number}","contents_url":"https://api.github.com/repos/yarpc/yarpc-go/contents/{+path}","compare_url":"https://api.github.com/repos/yarpc/yarpc-go/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yarpc/yarpc-go/merges","archive_url":"https://api.github.com/repos/yarpc/yarpc-go/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yarpc/yarpc-go/downloads","issues_url":"https://api.github.com/repos/yarpc/yarpc-go/issues{/number}","pulls_url":"https://api.github.com/repos/yarpc/yarpc-go/pulls{/number}","milestones_url":"https://api.github.com/repos/yarpc/yarpc-go/milestones{/number}","notifications_url":"https://api.github.com/repos/yarpc/yarpc-go/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yarpc/yarpc-go/labels{/name}","releases_url":"https://api.github.com/repos/yarpc/yarpc-go/releases{/id}","deployments_url":"https://api.github.com/repos/yarpc/yarpc-go/deployments","created_at":"2016-01-26T00:04:14Z","updated_at":"2016-07-28T02:25:48Z","pushed_at":"2016-08-09T17:38:23Z","git_url":"git://github.com/yarpc/yarpc-go.git","ssh_url":"git@github.com:yarpc/yarpc-go.git","clone_url":"https://github.com/yarpc/yarpc-go.git","svn_url":"https://github.com/yarpc/yarpc-go","homepage":"","size":6632,"stargazers_count":4,"watchers_count":4,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":32,"forks":0,"open_issues":32,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/yarpc/yarpc-go/pulls/282"},"html":{"href":"https://github.com/yarpc/yarpc-go/pull/282"},"issue":{"href":"https://api.github.com/repos/yarpc/yarpc-go/issues/282"},"comments":{"href":"https://api.github.com/repos/yarpc/yarpc-go/issues/282/comments"},"review_comments":{"href":"https://api.github.com/repos/yarpc/yarpc-go/pulls/282/comments"},"review_comment":{"href":"https://api.github.com/repos/yarpc/yarpc-go/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/yarpc/yarpc-go/pulls/282/commits"},"statuses":{"href":"https://api.github.com/repos/yarpc/yarpc-go/statuses/c9499fbac0b945eaacd96f02ece1c35f7338c84d"}}}}
{"actor":{"display_login":"breerly"}}