{"action":"created","comment":{"url":"https://api.github.com/repos/apache/beam/pulls/comments/180909437","pull_request_review_id":111416241,"id":180909437,"diff_hunk":"@@ -359,49 +348,40 @@ def add_input(self, element):\n     self.count += 1\n     self.sum += element\n     bucket_index = self.calculate_bucket_index(element)\n-    size_of_bucket = len(self.buckets)\n-    self.increment_bucket(bucket_index)\n-    if size_of_bucket == 0:\n-      self.first_bucket_offset = bucket_index\n-    else:\n-      self.first_bucket_offset = min(self.first_bucket_offset, bucket_index)\n+    self.buckets[bucket_index] += 1\n+    self.first_bucket_offset = min(self.first_bucket_offset, bucket_index)\n+    self.last_bucket_offset = max(self.last_bucket_offset, bucket_index)\n \n   def calculate_bucket_index(self, element):","path":"sdks/python/apache_beam/transforms/cy_combiners.py","position":85,"original_position":85,"commit_id":"367e48dba895159a01d9a4e098c275da83197f79","original_commit_id":"dd3ae5364c173a99c8a15f7e80960b9307993f7c","user":{"login":"charlesccychen","id":1055135,"avatar_url":"https://avatars2.githubusercontent.com/u/1055135?v=4","gravatar_id":"","url":"https://api.github.com/users/charlesccychen","html_url":"https://github.com/charlesccychen","followers_url":"https://api.github.com/users/charlesccychen/followers","following_url":"https://api.github.com/users/charlesccychen/following{/other_user}","gists_url":"https://api.github.com/users/charlesccychen/gists{/gist_id}","starred_url":"https://api.github.com/users/charlesccychen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/charlesccychen/subscriptions","organizations_url":"https://api.github.com/users/charlesccychen/orgs","repos_url":"https://api.github.com/users/charlesccychen/repos","events_url":"https://api.github.com/users/charlesccychen/events{/privacy}","received_events_url":"https://api.github.com/users/charlesccychen/received_events","type":"User","site_admin":false},"body":"<!--new_thread; commit:dd3ae5364c173a99c8a15f7e80960b9307993f7c; resolved:0-->\nPlease preserve old docstring.","created_at":"2018-04-11T21:51:58Z","updated_at":"2018-04-11T21:51:59Z","html_url":"https://github.com/apache/beam/pull/5028#discussion_r180909437","pull_request_url":"https://api.github.com/repos/apache/beam/pulls/5028","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/apache/beam/pulls/comments/180909437"},"html":{"href":"https://github.com/apache/beam/pull/5028#discussion_r180909437"},"pull_request":{"href":"https://api.github.com/repos/apache/beam/pulls/5028"}}},"pull_request":{"url":"https://api.github.com/repos/apache/beam/pulls/5028","id":179547139,"html_url":"https://github.com/apache/beam/pull/5028","diff_url":"https://github.com/apache/beam/pull/5028.diff","patch_url":"https://github.com/apache/beam/pull/5028.patch","issue_url":"https://api.github.com/repos/apache/beam/issues/5028","number":5028,"state":"open","locked":false,"title":"Cythonize DistributionAccumulator","user":{"login":"boyuanzz","id":36090911,"avatar_url":"https://avatars2.githubusercontent.com/u/36090911?v=4","gravatar_id":"","url":"https://api.github.com/users/boyuanzz","html_url":"https://github.com/boyuanzz","followers_url":"https://api.github.com/users/boyuanzz/followers","following_url":"https://api.github.com/users/boyuanzz/following{/other_user}","gists_url":"https://api.github.com/users/boyuanzz/gists{/gist_id}","starred_url":"https://api.github.com/users/boyuanzz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boyuanzz/subscriptions","organizations_url":"https://api.github.com/users/boyuanzz/orgs","repos_url":"https://api.github.com/users/boyuanzz/repos","events_url":"https://api.github.com/users/boyuanzz/events{/privacy}","received_events_url":"https://api.github.com/users/boyuanzz/received_events","type":"User","site_admin":false},"body":"Make DistirbutionAccumulator all cythonized to improve performance\r\n\r\nr:  @pabloem Please review code changes:\r\n[distribution_counter.pxd](https://github.com/apache/beam/pull/5028/files#diff-8cc8004b0aabd3a3a73027e022b59925) & [distribution_counter.pyx](https://github.com/apache/beam/pull/5028/files#diff-de946ea52f0492d898ecf61c8e051ee7):\r\nCythonize DistributionAccumulator. \r\nOriginal python implementation: https://github.com/apache/beam/pull/4613 & https://github.com/apache/beam/pull/4928\r\n\r\n[distribution_counter_test.py](https://github.com/apache/beam/pull/5028/files#diff-60375f462100c515e690f0774535fa1c):\r\nUnit tests for new Distributionaccumulator\r\n\r\n[cy_combiners.py](https://github.com/apache/beam/pull/5028/files#diff-bb661f94253059d6a39b383a30fd9a8e) & [cy_combiners.pxd](https://github.com/apache/beam/pull/5028/files#diff-636b00c67c9864284b0c400e76d9be32):\r\nDelete all original python implementation in https://github.com/apache/beam/pull/4613 & https://github.com/apache/beam/pull/4928\r\nAdded DistributionCounterFn, make new DistributionAccumulator as accumulator\r\n\r\n[cy_combiners_test.py & distribution_counter_test.py](https://github.com/apache/beam/pull/5028/files#diff-60375f462100c515e690f0774535fa1cl):\r\nCopy most part of DistributionAccumulator unit tests.\r\n\r\n[counters.py](https://github.com/apache/beam/pull/5028/files#diff-3c5714762090ef2e5b6c437303593494):\r\nCreate Counter.Distribution\r\nMake new DistributionAccumulator can work with CounterFactory\r\n\r\n[apiclient.py](https://github.com/apache/beam/pull/5028/files#diff-44359052680b20ce4f22a9436a83c43al):\r\nMake new DistributionAccumulator can report to DataflowService\r\n\r\n[apiclient_test.py](https://github.com/apache/beam/pull/5028/files#diff-32b72115a725f11ea87252abe743c001l):\r\nUnit test for apiclient.translate_distribution\r\n\r\n[distribution_counter_microbenchmark.py](https://github.com/apache/beam/pull/5028/files#diff-85403426a425dc32d6b067a593732dab):\r\nMake benchmarks point to new DistributionAccumulator\r\n\r\n[generac_pydoc.sh](https://github.com/apache/beam/pull/5028/files#diff-3aab4fb0a1e6b81f82ddd7038e52cc26):\r\nExclude distribution_counter \r\n\r\nr: @robertwb Please review performance part\r\nPerformance results by running distribution_counter_microbenchmark.py\r\n```\r\nCythonized DistributionAccumulator:\r\nPer element update time cost: 3.81579399109e-08\r\n```\r\n```\r\nPure python DistributionAccumulator\r\nPer element update time cost: 4.86792087555e-07\r\n``` \r\ncc: @charlesccychen ","created_at":"2018-04-05T00:39:04Z","updated_at":"2018-04-11T21:51:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1dc677116b1bcb963d1a6f9760b020c2dcbe3b1d","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/apache/beam/pulls/5028/commits","review_comments_url":"https://api.github.com/repos/apache/beam/pulls/5028/comments","review_comment_url":"https://api.github.com/repos/apache/beam/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/beam/issues/5028/comments","statuses_url":"https://api.github.com/repos/apache/beam/statuses/367e48dba895159a01d9a4e098c275da83197f79","head":{"label":"boyuanzz:new_distribution","ref":"new_distribution","sha":"367e48dba895159a01d9a4e098c275da83197f79","user":{"login":"boyuanzz","id":36090911,"avatar_url":"https://avatars2.githubusercontent.com/u/36090911?v=4","gravatar_id":"","url":"https://api.github.com/users/boyuanzz","html_url":"https://github.com/boyuanzz","followers_url":"https://api.github.com/users/boyuanzz/followers","following_url":"https://api.github.com/users/boyuanzz/following{/other_user}","gists_url":"https://api.github.com/users/boyuanzz/gists{/gist_id}","starred_url":"https://api.github.com/users/boyuanzz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boyuanzz/subscriptions","organizations_url":"https://api.github.com/users/boyuanzz/orgs","repos_url":"https://api.github.com/users/boyuanzz/repos","events_url":"https://api.github.com/users/boyuanzz/events{/privacy}","received_events_url":"https://api.github.com/users/boyuanzz/received_events","type":"User","site_admin":false},"repo":{"id":120047461,"name":"beam","full_name":"boyuanzz/beam","owner":{"login":"boyuanzz","id":36090911,"avatar_url":"https://avatars2.githubusercontent.com/u/36090911?v=4","gravatar_id":"","url":"https://api.github.com/users/boyuanzz","html_url":"https://github.com/boyuanzz","followers_url":"https://api.github.com/users/boyuanzz/followers","following_url":"https://api.github.com/users/boyuanzz/following{/other_user}","gists_url":"https://api.github.com/users/boyuanzz/gists{/gist_id}","starred_url":"https://api.github.com/users/boyuanzz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boyuanzz/subscriptions","organizations_url":"https://api.github.com/users/boyuanzz/orgs","repos_url":"https://api.github.com/users/boyuanzz/repos","events_url":"https://api.github.com/users/boyuanzz/events{/privacy}","received_events_url":"https://api.github.com/users/boyuanzz/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/boyuanzz/beam","description":"Apache Beam","fork":true,"url":"https://api.github.com/repos/boyuanzz/beam","forks_url":"https://api.github.com/repos/boyuanzz/beam/forks","keys_url":"https://api.github.com/repos/boyuanzz/beam/keys{/key_id}","collaborators_url":"https://api.github.com/repos/boyuanzz/beam/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/boyuanzz/beam/teams","hooks_url":"https://api.github.com/repos/boyuanzz/beam/hooks","issue_events_url":"https://api.github.com/repos/boyuanzz/beam/issues/events{/number}","events_url":"https://api.github.com/repos/boyuanzz/beam/events","assignees_url":"https://api.github.com/repos/boyuanzz/beam/assignees{/user}","branches_url":"https://api.github.com/repos/boyuanzz/beam/branches{/branch}","tags_url":"https://api.github.com/repos/boyuanzz/beam/tags","blobs_url":"https://api.github.com/repos/boyuanzz/beam/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/boyuanzz/beam/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/boyuanzz/beam/git/refs{/sha}","trees_url":"https://api.github.com/repos/boyuanzz/beam/git/trees{/sha}","statuses_url":"https://api.github.com/repos/boyuanzz/beam/statuses/{sha}","languages_url":"https://api.github.com/repos/boyuanzz/beam/languages","stargazers_url":"https://api.github.com/repos/boyuanzz/beam/stargazers","contributors_url":"https://api.github.com/repos/boyuanzz/beam/contributors","subscribers_url":"https://api.github.com/repos/boyuanzz/beam/subscribers","subscription_url":"https://api.github.com/repos/boyuanzz/beam/subscription","commits_url":"https://api.github.com/repos/boyuanzz/beam/commits{/sha}","git_commits_url":"https://api.github.com/repos/boyuanzz/beam/git/commits{/sha}","comments_url":"https://api.github.com/repos/boyuanzz/beam/comments{/number}","issue_comment_url":"https://api.github.com/repos/boyuanzz/beam/issues/comments{/number}","contents_url":"https://api.github.com/repos/boyuanzz/beam/contents/{+path}","compare_url":"https://api.github.com/repos/boyuanzz/beam/compare/{base}...{head}","merges_url":"https://api.github.com/repos/boyuanzz/beam/merges","archive_url":"https://api.github.com/repos/boyuanzz/beam/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/boyuanzz/beam/downloads","issues_url":"https://api.github.com/repos/boyuanzz/beam/issues{/number}","pulls_url":"https://api.github.com/repos/boyuanzz/beam/pulls{/number}","milestones_url":"https://api.github.com/repos/boyuanzz/beam/milestones{/number}","notifications_url":"https://api.github.com/repos/boyuanzz/beam/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/boyuanzz/beam/labels{/name}","releases_url":"https://api.github.com/repos/boyuanzz/beam/releases{/id}","deployments_url":"https://api.github.com/repos/boyuanzz/beam/deployments","created_at":"2018-02-03T00:59:30Z","updated_at":"2018-02-03T00:59:43Z","pushed_at":"2018-04-11T17:03:28Z","git_url":"git://github.com/boyuanzz/beam.git","ssh_url":"git@github.com:boyuanzz/beam.git","clone_url":"https://github.com/boyuanzz/beam.git","svn_url":"https://github.com/boyuanzz/beam","homepage":"","size":56466,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"52ab7c2fcfc11b65cede9d0120c4b70aab3f8c33","user":{"login":"apache","id":47359,"avatar_url":"https://avatars0.githubusercontent.com/u/47359?v=4","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":50904245,"name":"beam","full_name":"apache/beam","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars0.githubusercontent.com/u/47359?v=4","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apache/beam","description":"Apache Beam","fork":false,"url":"https://api.github.com/repos/apache/beam","forks_url":"https://api.github.com/repos/apache/beam/forks","keys_url":"https://api.github.com/repos/apache/beam/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/beam/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/beam/teams","hooks_url":"https://api.github.com/repos/apache/beam/hooks","issue_events_url":"https://api.github.com/repos/apache/beam/issues/events{/number}","events_url":"https://api.github.com/repos/apache/beam/events","assignees_url":"https://api.github.com/repos/apache/beam/assignees{/user}","branches_url":"https://api.github.com/repos/apache/beam/branches{/branch}","tags_url":"https://api.github.com/repos/apache/beam/tags","blobs_url":"https://api.github.com/repos/apache/beam/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/beam/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/beam/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/beam/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/beam/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/beam/languages","stargazers_url":"https://api.github.com/repos/apache/beam/stargazers","contributors_url":"https://api.github.com/repos/apache/beam/contributors","subscribers_url":"https://api.github.com/repos/apache/beam/subscribers","subscription_url":"https://api.github.com/repos/apache/beam/subscription","commits_url":"https://api.github.com/repos/apache/beam/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/beam/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/beam/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/beam/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/beam/contents/{+path}","compare_url":"https://api.github.com/repos/apache/beam/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/beam/merges","archive_url":"https://api.github.com/repos/apache/beam/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/beam/downloads","issues_url":"https://api.github.com/repos/apache/beam/issues{/number}","pulls_url":"https://api.github.com/repos/apache/beam/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/beam/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/beam/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/beam/labels{/name}","releases_url":"https://api.github.com/repos/apache/beam/releases{/id}","deployments_url":"https://api.github.com/repos/apache/beam/deployments","created_at":"2016-02-02T08:00:06Z","updated_at":"2018-04-11T21:23:49Z","pushed_at":"2018-04-11T21:27:37Z","git_url":"git://github.com/apache/beam.git","ssh_url":"git@github.com:apache/beam.git","clone_url":"https://github.com/apache/beam.git","svn_url":"https://github.com/apache/beam","homepage":"","size":56636,"stargazers_count":1806,"watchers_count":1806,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1097,"mirror_url":null,"archived":false,"open_issues_count":117,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":1097,"open_issues":117,"watchers":1806,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/beam/pulls/5028"},"html":{"href":"https://github.com/apache/beam/pull/5028"},"issue":{"href":"https://api.github.com/repos/apache/beam/issues/5028"},"comments":{"href":"https://api.github.com/repos/apache/beam/issues/5028/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/beam/pulls/5028/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/beam/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/beam/pulls/5028/commits"},"statuses":{"href":"https://api.github.com/repos/apache/beam/statuses/367e48dba895159a01d9a4e098c275da83197f79"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"charlesccychen"}}