{"action":"created","comment":{"url":"https://api.github.com/repos/DataDog/datadog-trace-agent/pulls/comments/94273931","pull_request_review_id":14804398,"id":94273931,"diff_hunk":"@@ -378,9 +346,44 @@ func TestReceiverServiceMsgpackDecoder(t *testing.T) {\n \t}\n }\n \n+func BenchmarkHandleTraces(b *testing.B) {\n+\t// prepare the payload\n+\tvar data []byte\n+\tenc := codec.NewEncoderBytes(&data, &codec.MsgpackHandle{})\n+\tenc.Encode(fixtures.GetTestTrace(1, 1))\n+\n+\t// prepare the receiver\n+\tconfig := config.NewDefaultAgentConfig()\n+\treceiver := NewHTTPReceiver(config)\n+\n+\t// response recorder\n+\thandler := http.HandlerFunc(httpHandleWithVersion(v03, receiver.handleTraces))\n+\n+\t// benchmark\n+\tb.ResetTimer()\n+\tb.ReportAllocs()\n+\tfor n := 0; n < b.N; n++ {\n+\t\tb.StopTimer()\n+\t\t// consume the traces channel without doing anything\n+\t\tselect {\n+\t\tcase <-receiver.traces:","path":"agent/receiver_test.go","position":115,"original_position":115,"commit_id":"3be1cd04beddf60920d4616583bb71acba949b33","original_commit_id":"3be1cd04beddf60920d4616583bb71acba949b33","user":{"login":"palazzem","id":1560405,"avatar_url":"https://avatars.githubusercontent.com/u/1560405?v=3","gravatar_id":"","url":"https://api.github.com/users/palazzem","html_url":"https://github.com/palazzem","followers_url":"https://api.github.com/users/palazzem/followers","following_url":"https://api.github.com/users/palazzem/following{/other_user}","gists_url":"https://api.github.com/users/palazzem/gists{/gist_id}","starred_url":"https://api.github.com/users/palazzem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/palazzem/subscriptions","organizations_url":"https://api.github.com/users/palazzem/orgs","repos_url":"https://api.github.com/users/palazzem/repos","events_url":"https://api.github.com/users/palazzem/events{/privacy}","received_events_url":"https://api.github.com/users/palazzem/received_events","type":"User","site_admin":false},"body":"since we don't have a background daemon, we should consume that channel otherwise we get stuck when the channel buffer is full","created_at":"2016-12-31T13:48:54Z","updated_at":"2016-12-31T13:48:54Z","html_url":"https://github.com/DataDog/datadog-trace-agent/pull/171#discussion_r94273931","pull_request_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/pulls/171","_links":{"self":{"href":"https://api.github.com/repos/DataDog/datadog-trace-agent/pulls/comments/94273931"},"html":{"href":"https://github.com/DataDog/datadog-trace-agent/pull/171#discussion_r94273931"},"pull_request":{"href":"https://api.github.com/repos/DataDog/datadog-trace-agent/pulls/171"}}},"pull_request":{"url":"https://api.github.com/repos/DataDog/datadog-trace-agent/pulls/171","id":99805091,"html_url":"https://github.com/DataDog/datadog-trace-agent/pull/171","diff_url":"https://github.com/DataDog/datadog-trace-agent/pull/171.diff","patch_url":"https://github.com/DataDog/datadog-trace-agent/pull/171.patch","issue_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/issues/171","number":171,"state":"open","locked":false,"title":"[optimization] improving pipeline entrypoint performance","user":{"login":"palazzem","id":1560405,"avatar_url":"https://avatars.githubusercontent.com/u/1560405?v=3","gravatar_id":"","url":"https://api.github.com/users/palazzem","html_url":"https://github.com/palazzem","followers_url":"https://api.github.com/users/palazzem/followers","following_url":"https://api.github.com/users/palazzem/following{/other_user}","gists_url":"https://api.github.com/users/palazzem/gists{/gist_id}","starred_url":"https://api.github.com/users/palazzem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/palazzem/subscriptions","organizations_url":"https://api.github.com/users/palazzem/orgs","repos_url":"https://api.github.com/users/palazzem/repos","events_url":"https://api.github.com/users/palazzem/events{/privacy}","received_events_url":"https://api.github.com/users/palazzem/received_events","type":"User","site_admin":false},"body":"### What it does\r\n\r\n* improves the ``ClientDecoder`` interface to make decoders implementations reusable\r\n* implements the ``jsonDecoder`` and ``msgpackDecoder`` structs to keep references to the internal buffers and decoders; in this way decoders are reusable multiple times\r\n* ``readAll`` re-implementation that overwrites the given buffer without any kind of allocations (the built-in version allocates a new resizable ``Buffer`` and returns a slice descriptor for each request)\r\n* when a decoder is created with the internal ``Buffer``, the buffer has ``minBufferSize`` size. This improves a lot performances because during each request the buffer is resized many times to contain the ``req.Body``\r\n* the request handler hot path, doesn't make useless allocations when a request is handled without errors.\r\n\r\n#### Performance impact\r\nThe benchmark includes the trace handling for a single trace with a single span, so the performance gain is linear with the number of traces. Furthermore, because we're not allocating anything (obviously with the exception of the ``[]Trace``), we're reducing the number of GC.\r\n\r\n```\r\nbenchmark                   old ns/op     new ns/op     delta\r\nBenchmarkHandleTraces-4     13198         9723          -26.33%\r\n\r\nbenchmark                   old allocs     new allocs     delta\r\nBenchmarkHandleTraces-4     33             23             -30.30%\r\n\r\nbenchmark                   old bytes     new bytes     delta\r\nBenchmarkHandleTraces-4     6530          1408          -78.44%\r\n```","created_at":"2016-12-31T13:44:07Z","updated_at":"2016-12-31T13:48:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"dce01b8907624eafebd9cc1dc0bab004feada34d","assignee":{"login":"ufoot","id":7057548,"avatar_url":"https://avatars.githubusercontent.com/u/7057548?v=3","gravatar_id":"","url":"https://api.github.com/users/ufoot","html_url":"https://github.com/ufoot","followers_url":"https://api.github.com/users/ufoot/followers","following_url":"https://api.github.com/users/ufoot/following{/other_user}","gists_url":"https://api.github.com/users/ufoot/gists{/gist_id}","starred_url":"https://api.github.com/users/ufoot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ufoot/subscriptions","organizations_url":"https://api.github.com/users/ufoot/orgs","repos_url":"https://api.github.com/users/ufoot/repos","events_url":"https://api.github.com/users/ufoot/events{/privacy}","received_events_url":"https://api.github.com/users/ufoot/received_events","type":"User","site_admin":false},"assignees":[{"login":"ufoot","id":7057548,"avatar_url":"https://avatars.githubusercontent.com/u/7057548?v=3","gravatar_id":"","url":"https://api.github.com/users/ufoot","html_url":"https://github.com/ufoot","followers_url":"https://api.github.com/users/ufoot/followers","following_url":"https://api.github.com/users/ufoot/following{/other_user}","gists_url":"https://api.github.com/users/ufoot/gists{/gist_id}","starred_url":"https://api.github.com/users/ufoot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ufoot/subscriptions","organizations_url":"https://api.github.com/users/ufoot/orgs","repos_url":"https://api.github.com/users/ufoot/repos","events_url":"https://api.github.com/users/ufoot/events{/privacy}","received_events_url":"https://api.github.com/users/ufoot/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/pulls/171/commits","review_comments_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/pulls/171/comments","review_comment_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/pulls/comments{/number}","comments_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/issues/171/comments","statuses_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/statuses/3be1cd04beddf60920d4616583bb71acba949b33","head":{"label":"DataDog:palazzem/buffers-pool","ref":"palazzem/buffers-pool","sha":"3be1cd04beddf60920d4616583bb71acba949b33","user":{"login":"DataDog","id":365230,"avatar_url":"https://avatars.githubusercontent.com/u/365230?v=3","gravatar_id":"","url":"https://api.github.com/users/DataDog","html_url":"https://github.com/DataDog","followers_url":"https://api.github.com/users/DataDog/followers","following_url":"https://api.github.com/users/DataDog/following{/other_user}","gists_url":"https://api.github.com/users/DataDog/gists{/gist_id}","starred_url":"https://api.github.com/users/DataDog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DataDog/subscriptions","organizations_url":"https://api.github.com/users/DataDog/orgs","repos_url":"https://api.github.com/users/DataDog/repos","events_url":"https://api.github.com/users/DataDog/events{/privacy}","received_events_url":"https://api.github.com/users/DataDog/received_events","type":"Organization","site_admin":false},"repo":{"id":38379832,"name":"datadog-trace-agent","full_name":"DataDog/datadog-trace-agent","owner":{"login":"DataDog","id":365230,"avatar_url":"https://avatars.githubusercontent.com/u/365230?v=3","gravatar_id":"","url":"https://api.github.com/users/DataDog","html_url":"https://github.com/DataDog","followers_url":"https://api.github.com/users/DataDog/followers","following_url":"https://api.github.com/users/DataDog/following{/other_user}","gists_url":"https://api.github.com/users/DataDog/gists{/gist_id}","starred_url":"https://api.github.com/users/DataDog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DataDog/subscriptions","organizations_url":"https://api.github.com/users/DataDog/orgs","repos_url":"https://api.github.com/users/DataDog/repos","events_url":"https://api.github.com/users/DataDog/events{/privacy}","received_events_url":"https://api.github.com/users/DataDog/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/DataDog/datadog-trace-agent","description":"Datadog APM agent.","fork":false,"url":"https://api.github.com/repos/DataDog/datadog-trace-agent","forks_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/forks","keys_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/teams","hooks_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/hooks","issue_events_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/issues/events{/number}","events_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/events","assignees_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/assignees{/user}","branches_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/branches{/branch}","tags_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/tags","blobs_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/git/refs{/sha}","trees_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/statuses/{sha}","languages_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/languages","stargazers_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/stargazers","contributors_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/contributors","subscribers_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/subscribers","subscription_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/subscription","commits_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/commits{/sha}","git_commits_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/git/commits{/sha}","comments_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/comments{/number}","issue_comment_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/issues/comments{/number}","contents_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/contents/{+path}","compare_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/merges","archive_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/downloads","issues_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/issues{/number}","pulls_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/pulls{/number}","milestones_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/milestones{/number}","notifications_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/labels{/name}","releases_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/releases{/id}","deployments_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/deployments","created_at":"2015-07-01T15:45:17Z","updated_at":"2016-12-22T03:42:19Z","pushed_at":"2016-12-31T13:44:09Z","git_url":"git://github.com/DataDog/datadog-trace-agent.git","ssh_url":"git@github.com:DataDog/datadog-trace-agent.git","clone_url":"https://github.com/DataDog/datadog-trace-agent.git","svn_url":"https://github.com/DataDog/datadog-trace-agent","homepage":"http://www.datadog.com","size":750,"stargazers_count":10,"watchers_count":10,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":6,"forks":1,"open_issues":6,"watchers":10,"default_branch":"master"}},"base":{"label":"DataDog:palazzem-ufoot/profiling-branch","ref":"palazzem-ufoot/profiling-branch","sha":"936451250de5e55b0c0003dbe82f1717be3f6e2f","user":{"login":"DataDog","id":365230,"avatar_url":"https://avatars.githubusercontent.com/u/365230?v=3","gravatar_id":"","url":"https://api.github.com/users/DataDog","html_url":"https://github.com/DataDog","followers_url":"https://api.github.com/users/DataDog/followers","following_url":"https://api.github.com/users/DataDog/following{/other_user}","gists_url":"https://api.github.com/users/DataDog/gists{/gist_id}","starred_url":"https://api.github.com/users/DataDog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DataDog/subscriptions","organizations_url":"https://api.github.com/users/DataDog/orgs","repos_url":"https://api.github.com/users/DataDog/repos","events_url":"https://api.github.com/users/DataDog/events{/privacy}","received_events_url":"https://api.github.com/users/DataDog/received_events","type":"Organization","site_admin":false},"repo":{"id":38379832,"name":"datadog-trace-agent","full_name":"DataDog/datadog-trace-agent","owner":{"login":"DataDog","id":365230,"avatar_url":"https://avatars.githubusercontent.com/u/365230?v=3","gravatar_id":"","url":"https://api.github.com/users/DataDog","html_url":"https://github.com/DataDog","followers_url":"https://api.github.com/users/DataDog/followers","following_url":"https://api.github.com/users/DataDog/following{/other_user}","gists_url":"https://api.github.com/users/DataDog/gists{/gist_id}","starred_url":"https://api.github.com/users/DataDog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DataDog/subscriptions","organizations_url":"https://api.github.com/users/DataDog/orgs","repos_url":"https://api.github.com/users/DataDog/repos","events_url":"https://api.github.com/users/DataDog/events{/privacy}","received_events_url":"https://api.github.com/users/DataDog/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/DataDog/datadog-trace-agent","description":"Datadog APM agent.","fork":false,"url":"https://api.github.com/repos/DataDog/datadog-trace-agent","forks_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/forks","keys_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/teams","hooks_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/hooks","issue_events_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/issues/events{/number}","events_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/events","assignees_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/assignees{/user}","branches_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/branches{/branch}","tags_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/tags","blobs_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/git/refs{/sha}","trees_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/statuses/{sha}","languages_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/languages","stargazers_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/stargazers","contributors_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/contributors","subscribers_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/subscribers","subscription_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/subscription","commits_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/commits{/sha}","git_commits_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/git/commits{/sha}","comments_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/comments{/number}","issue_comment_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/issues/comments{/number}","contents_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/contents/{+path}","compare_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/merges","archive_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/downloads","issues_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/issues{/number}","pulls_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/pulls{/number}","milestones_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/milestones{/number}","notifications_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/labels{/name}","releases_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/releases{/id}","deployments_url":"https://api.github.com/repos/DataDog/datadog-trace-agent/deployments","created_at":"2015-07-01T15:45:17Z","updated_at":"2016-12-22T03:42:19Z","pushed_at":"2016-12-31T13:44:09Z","git_url":"git://github.com/DataDog/datadog-trace-agent.git","ssh_url":"git@github.com:DataDog/datadog-trace-agent.git","clone_url":"https://github.com/DataDog/datadog-trace-agent.git","svn_url":"https://github.com/DataDog/datadog-trace-agent","homepage":"http://www.datadog.com","size":750,"stargazers_count":10,"watchers_count":10,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":6,"forks":1,"open_issues":6,"watchers":10,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/DataDog/datadog-trace-agent/pulls/171"},"html":{"href":"https://github.com/DataDog/datadog-trace-agent/pull/171"},"issue":{"href":"https://api.github.com/repos/DataDog/datadog-trace-agent/issues/171"},"comments":{"href":"https://api.github.com/repos/DataDog/datadog-trace-agent/issues/171/comments"},"review_comments":{"href":"https://api.github.com/repos/DataDog/datadog-trace-agent/pulls/171/comments"},"review_comment":{"href":"https://api.github.com/repos/DataDog/datadog-trace-agent/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/DataDog/datadog-trace-agent/pulls/171/commits"},"statuses":{"href":"https://api.github.com/repos/DataDog/datadog-trace-agent/statuses/3be1cd04beddf60920d4616583bb71acba949b33"}}}}
{"actor":{"display_login":"palazzem"}}