{"action":"created","comment":{"url":"https://api.github.com/repos/twitter/algebird/pulls/comments/36056508","id":36056508,"diff_hunk":"@@ -155,7 +243,7 @@ case class QTree[A](\n       ancestorLevel += 1\n       offsetDiff >>= 1\n     }\n-    ancestorLevel.max(level).max(other.level)\n+    ancestorLevel.max(_level).max(other.level)","path":"algebird-core/src/main/scala/com/twitter/algebird/QTree.scala","position":207,"original_position":207,"commit_id":"fadaf2e79cc5fd5918ccc29bb2282dd72edf5aab","original_commit_id":"fadaf2e79cc5fd5918ccc29bb2282dd72edf5aab","user":{"login":"sid-kap","id":6425077,"avatar_url":"https://avatars.githubusercontent.com/u/6425077?v=3","gravatar_id":"","url":"https://api.github.com/users/sid-kap","html_url":"https://github.com/sid-kap","followers_url":"https://api.github.com/users/sid-kap/followers","following_url":"https://api.github.com/users/sid-kap/following{/other_user}","gists_url":"https://api.github.com/users/sid-kap/gists{/gist_id}","starred_url":"https://api.github.com/users/sid-kap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sid-kap/subscriptions","organizations_url":"https://api.github.com/users/sid-kap/orgs","repos_url":"https://api.github.com/users/sid-kap/repos","events_url":"https://api.github.com/users/sid-kap/events{/privacy}","received_events_url":"https://api.github.com/users/sid-kap/received_events","type":"User","site_admin":false},"body":"Maybe use `scala.math.max` here to prevent boxing/unboxing?","created_at":"2015-08-03T05:09:22Z","updated_at":"2015-08-03T05:09:22Z","html_url":"https://github.com/twitter/algebird/pull/475#discussion_r36056508","pull_request_url":"https://api.github.com/repos/twitter/algebird/pulls/475","_links":{"self":{"href":"https://api.github.com/repos/twitter/algebird/pulls/comments/36056508"},"html":{"href":"https://github.com/twitter/algebird/pull/475#discussion_r36056508"},"pull_request":{"href":"https://api.github.com/repos/twitter/algebird/pulls/475"}}},"pull_request":{"url":"https://api.github.com/repos/twitter/algebird/pulls/475","id":41288716,"html_url":"https://github.com/twitter/algebird/pull/475","diff_url":"https://github.com/twitter/algebird/pull/475.diff","patch_url":"https://github.com/twitter/algebird/pull/475.patch","issue_url":"https://api.github.com/repos/twitter/algebird/issues/475","number":475,"state":"open","locked":false,"title":"Optimize QTree a bunch","user":{"login":"ianoc","id":446652,"avatar_url":"https://avatars.githubusercontent.com/u/446652?v=3","gravatar_id":"","url":"https://api.github.com/users/ianoc","html_url":"https://github.com/ianoc","followers_url":"https://api.github.com/users/ianoc/followers","following_url":"https://api.github.com/users/ianoc/following{/other_user}","gists_url":"https://api.github.com/users/ianoc/gists{/gist_id}","starred_url":"https://api.github.com/users/ianoc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ianoc/subscriptions","organizations_url":"https://api.github.com/users/ianoc/orgs","repos_url":"https://api.github.com/users/ianoc/repos","events_url":"https://api.github.com/users/ianoc/events{/privacy}","received_events_url":"https://api.github.com/users/ianoc/received_events","type":"User","site_admin":false},"body":"1) Internally use nullable instances of QTree rather than Option[QTree].\r\n2) Specialize the class\r\n3) Pre build an array with the range values rather than calculating pow(2, level) on each instanciation\r\n\r\nPerformance numbers:\r\n\r\nDevelop::\r\n[info] Benchmark                           (depthK)  (numElements)  Mode  Cnt         Score         Error  Units\r\n[info] QTreeBenchmark.timePlusDouble              6          10000  avgt   15  49604065.294 ±  343946.724  ns/op\r\n[info] QTreeBenchmark.timePlusLong                6          10000  avgt   15  54040361.060 ±  451564.394  ns/op\r\n[info] QTreeBenchmark.timePlusUnit                6          10000  avgt   15  52363803.668 ± 1403481.464  ns/op\r\n[info] QTreeBenchmark.timeSumOptionDouble         6          10000  avgt   15  18536550.306 ±  102450.054  ns/op\r\n[info] QTreeBenchmark.timeSumOptionLong           6          10000  avgt   15  14265313.429 ±   80999.618  ns/op\r\n[info] QTreeBenchmark.timeSumOptionUnit           6          10000  avgt   15  14109388.526 ±  139901.693  ns/op\r\n\r\n\r\nBranch::\r\n\r\n[info] Benchmark                           (depthK)  (numElements)  Mode  Cnt         Score        Error  Units\r\n[info] QTreeBenchmark.timePlusDouble              6          10000  avgt   15  36130358.089 ± 344895.234  ns/op\r\n[info] QTreeBenchmark.timePlusLong                6          10000  avgt   15  40619584.216 ± 213205.614  ns/op\r\n[info] QTreeBenchmark.timePlusUnit                6          10000  avgt   15  35111406.421 ± 175324.238  ns/op\r\n[info] QTreeBenchmark.timeSumOptionDouble         6          10000  avgt   15   8657591.363 ± 148336.269  ns/op\r\n[info] QTreeBenchmark.timeSumOptionLong           6          10000  avgt   15   5310313.465 ±  88287.513  ns/op\r\n[info] QTreeBenchmark.timeSumOptionUnit           6          10000  avgt   15   4735604.540 ±  45094.848  ns/op\r\n\r\n","created_at":"2015-07-30T22:19:09Z","updated_at":"2015-08-03T05:09:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5421eb06c4adc52bce01b8dfe16550eea0a09e13","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/twitter/algebird/pulls/475/commits","review_comments_url":"https://api.github.com/repos/twitter/algebird/pulls/475/comments","review_comment_url":"https://api.github.com/repos/twitter/algebird/pulls/comments{/number}","comments_url":"https://api.github.com/repos/twitter/algebird/issues/475/comments","statuses_url":"https://api.github.com/repos/twitter/algebird/statuses/fadaf2e79cc5fd5918ccc29bb2282dd72edf5aab","head":{"label":"twitter:ianoc/optimizeQTree","ref":"ianoc/optimizeQTree","sha":"fadaf2e79cc5fd5918ccc29bb2282dd72edf5aab","user":{"login":"twitter","id":50278,"avatar_url":"https://avatars.githubusercontent.com/u/50278?v=3","gravatar_id":"","url":"https://api.github.com/users/twitter","html_url":"https://github.com/twitter","followers_url":"https://api.github.com/users/twitter/followers","following_url":"https://api.github.com/users/twitter/following{/other_user}","gists_url":"https://api.github.com/users/twitter/gists{/gist_id}","starred_url":"https://api.github.com/users/twitter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/twitter/subscriptions","organizations_url":"https://api.github.com/users/twitter/orgs","repos_url":"https://api.github.com/users/twitter/repos","events_url":"https://api.github.com/users/twitter/events{/privacy}","received_events_url":"https://api.github.com/users/twitter/received_events","type":"Organization","site_admin":false},"repo":{"id":5275507,"name":"algebird","full_name":"twitter/algebird","owner":{"login":"twitter","id":50278,"avatar_url":"https://avatars.githubusercontent.com/u/50278?v=3","gravatar_id":"","url":"https://api.github.com/users/twitter","html_url":"https://github.com/twitter","followers_url":"https://api.github.com/users/twitter/followers","following_url":"https://api.github.com/users/twitter/following{/other_user}","gists_url":"https://api.github.com/users/twitter/gists{/gist_id}","starred_url":"https://api.github.com/users/twitter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/twitter/subscriptions","organizations_url":"https://api.github.com/users/twitter/orgs","repos_url":"https://api.github.com/users/twitter/repos","events_url":"https://api.github.com/users/twitter/events{/privacy}","received_events_url":"https://api.github.com/users/twitter/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/twitter/algebird","description":"Abstract Algebra for Scala","fork":false,"url":"https://api.github.com/repos/twitter/algebird","forks_url":"https://api.github.com/repos/twitter/algebird/forks","keys_url":"https://api.github.com/repos/twitter/algebird/keys{/key_id}","collaborators_url":"https://api.github.com/repos/twitter/algebird/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/twitter/algebird/teams","hooks_url":"https://api.github.com/repos/twitter/algebird/hooks","issue_events_url":"https://api.github.com/repos/twitter/algebird/issues/events{/number}","events_url":"https://api.github.com/repos/twitter/algebird/events","assignees_url":"https://api.github.com/repos/twitter/algebird/assignees{/user}","branches_url":"https://api.github.com/repos/twitter/algebird/branches{/branch}","tags_url":"https://api.github.com/repos/twitter/algebird/tags","blobs_url":"https://api.github.com/repos/twitter/algebird/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/twitter/algebird/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/twitter/algebird/git/refs{/sha}","trees_url":"https://api.github.com/repos/twitter/algebird/git/trees{/sha}","statuses_url":"https://api.github.com/repos/twitter/algebird/statuses/{sha}","languages_url":"https://api.github.com/repos/twitter/algebird/languages","stargazers_url":"https://api.github.com/repos/twitter/algebird/stargazers","contributors_url":"https://api.github.com/repos/twitter/algebird/contributors","subscribers_url":"https://api.github.com/repos/twitter/algebird/subscribers","subscription_url":"https://api.github.com/repos/twitter/algebird/subscription","commits_url":"https://api.github.com/repos/twitter/algebird/commits{/sha}","git_commits_url":"https://api.github.com/repos/twitter/algebird/git/commits{/sha}","comments_url":"https://api.github.com/repos/twitter/algebird/comments{/number}","issue_comment_url":"https://api.github.com/repos/twitter/algebird/issues/comments{/number}","contents_url":"https://api.github.com/repos/twitter/algebird/contents/{+path}","compare_url":"https://api.github.com/repos/twitter/algebird/compare/{base}...{head}","merges_url":"https://api.github.com/repos/twitter/algebird/merges","archive_url":"https://api.github.com/repos/twitter/algebird/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/twitter/algebird/downloads","issues_url":"https://api.github.com/repos/twitter/algebird/issues{/number}","pulls_url":"https://api.github.com/repos/twitter/algebird/pulls{/number}","milestones_url":"https://api.github.com/repos/twitter/algebird/milestones{/number}","notifications_url":"https://api.github.com/repos/twitter/algebird/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/twitter/algebird/labels{/name}","releases_url":"https://api.github.com/repos/twitter/algebird/releases{/id}","created_at":"2012-08-02T17:24:42Z","updated_at":"2015-08-01T06:26:09Z","pushed_at":"2015-08-01T00:51:54Z","git_url":"git://github.com/twitter/algebird.git","ssh_url":"git@github.com:twitter/algebird.git","clone_url":"https://github.com/twitter/algebird.git","svn_url":"https://github.com/twitter/algebird","homepage":"https://twitter.com/scalding","size":7780,"stargazers_count":963,"watchers_count":963,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":177,"mirror_url":null,"open_issues_count":100,"forks":177,"open_issues":100,"watchers":963,"default_branch":"develop"}},"base":{"label":"twitter:ianoc/qTreeBenchmarkMoreCoverage","ref":"ianoc/qTreeBenchmarkMoreCoverage","sha":"0e52dbceb404b6ee3bbc0d4188de125b82199057","user":{"login":"twitter","id":50278,"avatar_url":"https://avatars.githubusercontent.com/u/50278?v=3","gravatar_id":"","url":"https://api.github.com/users/twitter","html_url":"https://github.com/twitter","followers_url":"https://api.github.com/users/twitter/followers","following_url":"https://api.github.com/users/twitter/following{/other_user}","gists_url":"https://api.github.com/users/twitter/gists{/gist_id}","starred_url":"https://api.github.com/users/twitter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/twitter/subscriptions","organizations_url":"https://api.github.com/users/twitter/orgs","repos_url":"https://api.github.com/users/twitter/repos","events_url":"https://api.github.com/users/twitter/events{/privacy}","received_events_url":"https://api.github.com/users/twitter/received_events","type":"Organization","site_admin":false},"repo":{"id":5275507,"name":"algebird","full_name":"twitter/algebird","owner":{"login":"twitter","id":50278,"avatar_url":"https://avatars.githubusercontent.com/u/50278?v=3","gravatar_id":"","url":"https://api.github.com/users/twitter","html_url":"https://github.com/twitter","followers_url":"https://api.github.com/users/twitter/followers","following_url":"https://api.github.com/users/twitter/following{/other_user}","gists_url":"https://api.github.com/users/twitter/gists{/gist_id}","starred_url":"https://api.github.com/users/twitter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/twitter/subscriptions","organizations_url":"https://api.github.com/users/twitter/orgs","repos_url":"https://api.github.com/users/twitter/repos","events_url":"https://api.github.com/users/twitter/events{/privacy}","received_events_url":"https://api.github.com/users/twitter/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/twitter/algebird","description":"Abstract Algebra for Scala","fork":false,"url":"https://api.github.com/repos/twitter/algebird","forks_url":"https://api.github.com/repos/twitter/algebird/forks","keys_url":"https://api.github.com/repos/twitter/algebird/keys{/key_id}","collaborators_url":"https://api.github.com/repos/twitter/algebird/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/twitter/algebird/teams","hooks_url":"https://api.github.com/repos/twitter/algebird/hooks","issue_events_url":"https://api.github.com/repos/twitter/algebird/issues/events{/number}","events_url":"https://api.github.com/repos/twitter/algebird/events","assignees_url":"https://api.github.com/repos/twitter/algebird/assignees{/user}","branches_url":"https://api.github.com/repos/twitter/algebird/branches{/branch}","tags_url":"https://api.github.com/repos/twitter/algebird/tags","blobs_url":"https://api.github.com/repos/twitter/algebird/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/twitter/algebird/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/twitter/algebird/git/refs{/sha}","trees_url":"https://api.github.com/repos/twitter/algebird/git/trees{/sha}","statuses_url":"https://api.github.com/repos/twitter/algebird/statuses/{sha}","languages_url":"https://api.github.com/repos/twitter/algebird/languages","stargazers_url":"https://api.github.com/repos/twitter/algebird/stargazers","contributors_url":"https://api.github.com/repos/twitter/algebird/contributors","subscribers_url":"https://api.github.com/repos/twitter/algebird/subscribers","subscription_url":"https://api.github.com/repos/twitter/algebird/subscription","commits_url":"https://api.github.com/repos/twitter/algebird/commits{/sha}","git_commits_url":"https://api.github.com/repos/twitter/algebird/git/commits{/sha}","comments_url":"https://api.github.com/repos/twitter/algebird/comments{/number}","issue_comment_url":"https://api.github.com/repos/twitter/algebird/issues/comments{/number}","contents_url":"https://api.github.com/repos/twitter/algebird/contents/{+path}","compare_url":"https://api.github.com/repos/twitter/algebird/compare/{base}...{head}","merges_url":"https://api.github.com/repos/twitter/algebird/merges","archive_url":"https://api.github.com/repos/twitter/algebird/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/twitter/algebird/downloads","issues_url":"https://api.github.com/repos/twitter/algebird/issues{/number}","pulls_url":"https://api.github.com/repos/twitter/algebird/pulls{/number}","milestones_url":"https://api.github.com/repos/twitter/algebird/milestones{/number}","notifications_url":"https://api.github.com/repos/twitter/algebird/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/twitter/algebird/labels{/name}","releases_url":"https://api.github.com/repos/twitter/algebird/releases{/id}","created_at":"2012-08-02T17:24:42Z","updated_at":"2015-08-01T06:26:09Z","pushed_at":"2015-08-01T00:51:54Z","git_url":"git://github.com/twitter/algebird.git","ssh_url":"git@github.com:twitter/algebird.git","clone_url":"https://github.com/twitter/algebird.git","svn_url":"https://github.com/twitter/algebird","homepage":"https://twitter.com/scalding","size":7780,"stargazers_count":963,"watchers_count":963,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":177,"mirror_url":null,"open_issues_count":100,"forks":177,"open_issues":100,"watchers":963,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/twitter/algebird/pulls/475"},"html":{"href":"https://github.com/twitter/algebird/pull/475"},"issue":{"href":"https://api.github.com/repos/twitter/algebird/issues/475"},"comments":{"href":"https://api.github.com/repos/twitter/algebird/issues/475/comments"},"review_comments":{"href":"https://api.github.com/repos/twitter/algebird/pulls/475/comments"},"review_comment":{"href":"https://api.github.com/repos/twitter/algebird/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/twitter/algebird/pulls/475/commits"},"statuses":{"href":"https://api.github.com/repos/twitter/algebird/statuses/fadaf2e79cc5fd5918ccc29bb2282dd72edf5aab"}}}}