{"action":"created","comment":{"url":"https://api.github.com/repos/akka/akka/pulls/comments/58360581","id":58360581,"diff_hunk":"@@ -528,7 +528,7 @@ object CompactByteString {\n     else {\n       val ar = new Array[Byte](bytes.size)\n       bytes.copyToArray(ar)\n-      CompactByteString(ar)\n+      ByteString.ByteString1C(ar)","path":"akka-actor/src/main/scala/akka/util/ByteString.scala","position":5,"original_position":5,"commit_id":"2150dabdc940163c76b880fc653ffcce36ae4f14","original_commit_id":"2150dabdc940163c76b880fc653ffcce36ae4f14","user":{"login":"patriknw","id":336161,"avatar_url":"https://avatars.githubusercontent.com/u/336161?v=3","gravatar_id":"","url":"https://api.github.com/users/patriknw","html_url":"https://github.com/patriknw","followers_url":"https://api.github.com/users/patriknw/followers","following_url":"https://api.github.com/users/patriknw/following{/other_user}","gists_url":"https://api.github.com/users/patriknw/gists{/gist_id}","starred_url":"https://api.github.com/users/patriknw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/patriknw/subscriptions","organizations_url":"https://api.github.com/users/patriknw/orgs","repos_url":"https://api.github.com/users/patriknw/repos","events_url":"https://api.github.com/users/patriknw/events{/privacy}","received_events_url":"https://api.github.com/users/patriknw/received_events","type":"User","site_admin":false},"body":"I wonder if we can do even better by\r\n\r\n```\r\nelse \r\n  ByteString.ByteString1C(bytes.toArray)\r\n```\r\n\r\nThe varargs `bytes` is a `scala.collection.mutable.WrappedArray$ofByte` and the `toArray` is therefore a cast of the internal array. cloning is done by `ByteString1C`","created_at":"2016-04-04T11:17:41Z","updated_at":"2016-04-04T11:17:41Z","html_url":"https://github.com/akka/akka/pull/20206#discussion_r58360581","pull_request_url":"https://api.github.com/repos/akka/akka/pulls/20206","_links":{"self":{"href":"https://api.github.com/repos/akka/akka/pulls/comments/58360581"},"html":{"href":"https://github.com/akka/akka/pull/20206#discussion_r58360581"},"pull_request":{"href":"https://api.github.com/repos/akka/akka/pulls/20206"}}},"pull_request":{"url":"https://api.github.com/repos/akka/akka/pulls/20206","id":65033686,"html_url":"https://github.com/akka/akka/pull/20206","diff_url":"https://github.com/akka/akka/pull/20206.diff","patch_url":"https://github.com/akka/akka/pull/20206.patch","issue_url":"https://api.github.com/repos/akka/akka/issues/20206","number":20206,"state":"open","locked":false,"title":"Eliminate doublecopy of byte array","user":{"login":"alno","id":30774,"avatar_url":"https://avatars.githubusercontent.com/u/30774?v=3","gravatar_id":"","url":"https://api.github.com/users/alno","html_url":"https://github.com/alno","followers_url":"https://api.github.com/users/alno/followers","following_url":"https://api.github.com/users/alno/following{/other_user}","gists_url":"https://api.github.com/users/alno/gists{/gist_id}","starred_url":"https://api.github.com/users/alno/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alno/subscriptions","organizations_url":"https://api.github.com/users/alno/orgs","repos_url":"https://api.github.com/users/alno/repos","events_url":"https://api.github.com/users/alno/events{/privacy}","received_events_url":"https://api.github.com/users/alno/received_events","type":"User","site_admin":false},"body":"When `CompactByteString` is created from varargs, args are copied to the new byte array in `apply(bytes: Byte*)` method, then this array is passed to `apply(bytes: Array[Byte])` there it's copied again. \r\n\r\nSecond copy is unnecessary and may be eliminated by calling `ByteString.ByteString1C` directly. Also, it makes code more consistent, because other apply methods already call it directly on generated byte arrays.","created_at":"2016-04-02T09:52:16Z","updated_at":"2016-04-04T11:17:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"04ef0296491cdff143e9832eba620d8c224178c9","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/akka/akka/pulls/20206/commits","review_comments_url":"https://api.github.com/repos/akka/akka/pulls/20206/comments","review_comment_url":"https://api.github.com/repos/akka/akka/pulls/comments{/number}","comments_url":"https://api.github.com/repos/akka/akka/issues/20206/comments","statuses_url":"https://api.github.com/repos/akka/akka/statuses/2150dabdc940163c76b880fc653ffcce36ae4f14","head":{"label":"alno:bytestring-double-copy","ref":"bytestring-double-copy","sha":"2150dabdc940163c76b880fc653ffcce36ae4f14","user":{"login":"alno","id":30774,"avatar_url":"https://avatars.githubusercontent.com/u/30774?v=3","gravatar_id":"","url":"https://api.github.com/users/alno","html_url":"https://github.com/alno","followers_url":"https://api.github.com/users/alno/followers","following_url":"https://api.github.com/users/alno/following{/other_user}","gists_url":"https://api.github.com/users/alno/gists{/gist_id}","starred_url":"https://api.github.com/users/alno/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alno/subscriptions","organizations_url":"https://api.github.com/users/alno/orgs","repos_url":"https://api.github.com/users/alno/repos","events_url":"https://api.github.com/users/alno/events{/privacy}","received_events_url":"https://api.github.com/users/alno/received_events","type":"User","site_admin":false},"repo":{"id":55287465,"name":"akka","full_name":"alno/akka","owner":{"login":"alno","id":30774,"avatar_url":"https://avatars.githubusercontent.com/u/30774?v=3","gravatar_id":"","url":"https://api.github.com/users/alno","html_url":"https://github.com/alno","followers_url":"https://api.github.com/users/alno/followers","following_url":"https://api.github.com/users/alno/following{/other_user}","gists_url":"https://api.github.com/users/alno/gists{/gist_id}","starred_url":"https://api.github.com/users/alno/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alno/subscriptions","organizations_url":"https://api.github.com/users/alno/orgs","repos_url":"https://api.github.com/users/alno/repos","events_url":"https://api.github.com/users/alno/events{/privacy}","received_events_url":"https://api.github.com/users/alno/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/alno/akka","description":"Akka Project","fork":true,"url":"https://api.github.com/repos/alno/akka","forks_url":"https://api.github.com/repos/alno/akka/forks","keys_url":"https://api.github.com/repos/alno/akka/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alno/akka/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alno/akka/teams","hooks_url":"https://api.github.com/repos/alno/akka/hooks","issue_events_url":"https://api.github.com/repos/alno/akka/issues/events{/number}","events_url":"https://api.github.com/repos/alno/akka/events","assignees_url":"https://api.github.com/repos/alno/akka/assignees{/user}","branches_url":"https://api.github.com/repos/alno/akka/branches{/branch}","tags_url":"https://api.github.com/repos/alno/akka/tags","blobs_url":"https://api.github.com/repos/alno/akka/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alno/akka/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alno/akka/git/refs{/sha}","trees_url":"https://api.github.com/repos/alno/akka/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alno/akka/statuses/{sha}","languages_url":"https://api.github.com/repos/alno/akka/languages","stargazers_url":"https://api.github.com/repos/alno/akka/stargazers","contributors_url":"https://api.github.com/repos/alno/akka/contributors","subscribers_url":"https://api.github.com/repos/alno/akka/subscribers","subscription_url":"https://api.github.com/repos/alno/akka/subscription","commits_url":"https://api.github.com/repos/alno/akka/commits{/sha}","git_commits_url":"https://api.github.com/repos/alno/akka/git/commits{/sha}","comments_url":"https://api.github.com/repos/alno/akka/comments{/number}","issue_comment_url":"https://api.github.com/repos/alno/akka/issues/comments{/number}","contents_url":"https://api.github.com/repos/alno/akka/contents/{+path}","compare_url":"https://api.github.com/repos/alno/akka/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alno/akka/merges","archive_url":"https://api.github.com/repos/alno/akka/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alno/akka/downloads","issues_url":"https://api.github.com/repos/alno/akka/issues{/number}","pulls_url":"https://api.github.com/repos/alno/akka/pulls{/number}","milestones_url":"https://api.github.com/repos/alno/akka/milestones{/number}","notifications_url":"https://api.github.com/repos/alno/akka/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alno/akka/labels{/name}","releases_url":"https://api.github.com/repos/alno/akka/releases{/id}","deployments_url":"https://api.github.com/repos/alno/akka/deployments","created_at":"2016-04-02T09:35:14Z","updated_at":"2016-04-02T09:35:26Z","pushed_at":"2016-04-02T09:39:48Z","git_url":"git://github.com/alno/akka.git","ssh_url":"git@github.com:alno/akka.git","clone_url":"https://github.com/alno/akka.git","svn_url":"https://github.com/alno/akka","homepage":"http://akka.io","size":192120,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"akka:master","ref":"master","sha":"8449647e4000dd7d25c97c851d51906351ee531d","user":{"login":"akka","id":1496237,"avatar_url":"https://avatars.githubusercontent.com/u/1496237?v=3","gravatar_id":"","url":"https://api.github.com/users/akka","html_url":"https://github.com/akka","followers_url":"https://api.github.com/users/akka/followers","following_url":"https://api.github.com/users/akka/following{/other_user}","gists_url":"https://api.github.com/users/akka/gists{/gist_id}","starred_url":"https://api.github.com/users/akka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akka/subscriptions","organizations_url":"https://api.github.com/users/akka/orgs","repos_url":"https://api.github.com/users/akka/repos","events_url":"https://api.github.com/users/akka/events{/privacy}","received_events_url":"https://api.github.com/users/akka/received_events","type":"Organization","site_admin":false},"repo":{"id":130013,"name":"akka","full_name":"akka/akka","owner":{"login":"akka","id":1496237,"avatar_url":"https://avatars.githubusercontent.com/u/1496237?v=3","gravatar_id":"","url":"https://api.github.com/users/akka","html_url":"https://github.com/akka","followers_url":"https://api.github.com/users/akka/followers","following_url":"https://api.github.com/users/akka/following{/other_user}","gists_url":"https://api.github.com/users/akka/gists{/gist_id}","starred_url":"https://api.github.com/users/akka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akka/subscriptions","organizations_url":"https://api.github.com/users/akka/orgs","repos_url":"https://api.github.com/users/akka/repos","events_url":"https://api.github.com/users/akka/events{/privacy}","received_events_url":"https://api.github.com/users/akka/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/akka/akka","description":"Akka Project","fork":false,"url":"https://api.github.com/repos/akka/akka","forks_url":"https://api.github.com/repos/akka/akka/forks","keys_url":"https://api.github.com/repos/akka/akka/keys{/key_id}","collaborators_url":"https://api.github.com/repos/akka/akka/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/akka/akka/teams","hooks_url":"https://api.github.com/repos/akka/akka/hooks","issue_events_url":"https://api.github.com/repos/akka/akka/issues/events{/number}","events_url":"https://api.github.com/repos/akka/akka/events","assignees_url":"https://api.github.com/repos/akka/akka/assignees{/user}","branches_url":"https://api.github.com/repos/akka/akka/branches{/branch}","tags_url":"https://api.github.com/repos/akka/akka/tags","blobs_url":"https://api.github.com/repos/akka/akka/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/akka/akka/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/akka/akka/git/refs{/sha}","trees_url":"https://api.github.com/repos/akka/akka/git/trees{/sha}","statuses_url":"https://api.github.com/repos/akka/akka/statuses/{sha}","languages_url":"https://api.github.com/repos/akka/akka/languages","stargazers_url":"https://api.github.com/repos/akka/akka/stargazers","contributors_url":"https://api.github.com/repos/akka/akka/contributors","subscribers_url":"https://api.github.com/repos/akka/akka/subscribers","subscription_url":"https://api.github.com/repos/akka/akka/subscription","commits_url":"https://api.github.com/repos/akka/akka/commits{/sha}","git_commits_url":"https://api.github.com/repos/akka/akka/git/commits{/sha}","comments_url":"https://api.github.com/repos/akka/akka/comments{/number}","issue_comment_url":"https://api.github.com/repos/akka/akka/issues/comments{/number}","contents_url":"https://api.github.com/repos/akka/akka/contents/{+path}","compare_url":"https://api.github.com/repos/akka/akka/compare/{base}...{head}","merges_url":"https://api.github.com/repos/akka/akka/merges","archive_url":"https://api.github.com/repos/akka/akka/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/akka/akka/downloads","issues_url":"https://api.github.com/repos/akka/akka/issues{/number}","pulls_url":"https://api.github.com/repos/akka/akka/pulls{/number}","milestones_url":"https://api.github.com/repos/akka/akka/milestones{/number}","notifications_url":"https://api.github.com/repos/akka/akka/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/akka/akka/labels{/name}","releases_url":"https://api.github.com/repos/akka/akka/releases{/id}","deployments_url":"https://api.github.com/repos/akka/akka/deployments","created_at":"2009-02-16T12:51:54Z","updated_at":"2016-04-04T07:58:10Z","pushed_at":"2016-04-04T11:11:26Z","git_url":"git://github.com/akka/akka.git","ssh_url":"git@github.com:akka/akka.git","clone_url":"https://github.com/akka/akka.git","svn_url":"https://github.com/akka/akka","homepage":"http://akka.io","size":203620,"stargazers_count":5334,"watchers_count":5334,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1657,"mirror_url":null,"open_issues_count":728,"forks":1657,"open_issues":728,"watchers":5334,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/akka/akka/pulls/20206"},"html":{"href":"https://github.com/akka/akka/pull/20206"},"issue":{"href":"https://api.github.com/repos/akka/akka/issues/20206"},"comments":{"href":"https://api.github.com/repos/akka/akka/issues/20206/comments"},"review_comments":{"href":"https://api.github.com/repos/akka/akka/pulls/20206/comments"},"review_comment":{"href":"https://api.github.com/repos/akka/akka/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/akka/akka/pulls/20206/commits"},"statuses":{"href":"https://api.github.com/repos/akka/akka/statuses/2150dabdc940163c76b880fc653ffcce36ae4f14"}}}}