{"action":"created","comment":{"url":"https://api.github.com/repos/scala/scala/pulls/comments/209504897","pull_request_review_id":145530091,"id":209504897,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwOTUwNDg5Nw==","diff_hunk":"@@ -402,14 +441,14 @@ final class Vector[+A] private[immutable] (private[collection] val startIndex: I\n     }\n   }\n \n-  private def copyLeft(array: Array[AnyRef], right: Int): Array[AnyRef] = {\n-    val copy = new Array[AnyRef](array.length)\n-    java.lang.System.arraycopy(array, 0, copy, 0, right)\n+  private def copyLeft[T <: AnyRef](array: Array[T], right: Int): Array[T] = {\n+    val copy = array.clone()\n+    java.util.Arrays.fill(copy.asInstanceOf[Array[AnyRef]], right, array.length, null)","path":"src/library/scala/collection/immutable/Vector.scala","position":63,"original_position":55,"commit_id":"9ad4ff90114cc93804172e9f1ef7236443a69697","original_commit_id":"3b8f7b851543078a85249d8b66e8b544622cb467","user":{"login":"retronym","id":65551,"node_id":"MDQ6VXNlcjY1NTUx","avatar_url":"https://avatars0.githubusercontent.com/u/65551?v=4","gravatar_id":"","url":"https://api.github.com/users/retronym","html_url":"https://github.com/retronym","followers_url":"https://api.github.com/users/retronym/followers","following_url":"https://api.github.com/users/retronym/following{/other_user}","gists_url":"https://api.github.com/users/retronym/gists{/gist_id}","starred_url":"https://api.github.com/users/retronym/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/retronym/subscriptions","organizations_url":"https://api.github.com/users/retronym/orgs","repos_url":"https://api.github.com/users/retronym/repos","events_url":"https://api.github.com/users/retronym/events{/privacy}","received_events_url":"https://api.github.com/users/retronym/received_events","type":"User","site_admin":false},"body":"Okay. I think your solution with `clone()` is probably okay because these arrays are tiny, so we might not see the effect of copying the trailing elements before nulling them out.\r\n\r\nBut the following is probably the smallest delta from the original code, all it changes is making your intended change to strongly type the arrays to avoid the need for a `checkcast` on the elements after reading out of `display{1-5}`.\r\n\r\n```scala\r\n  private def copyLeft[T <: AnyRef](array: Array[T], right: Int): Array[T] = {\r\n    val copy = \r\n      if (array.getClass.getComponentType eq classOf[AnyRef]) new Array[AnyRef](array.length) \r\n      else java.lang.reflect.Array.newInstance(array.getClass.getComponentType, array.length)\r\n    java.lang.System.arraycopy(array, 0, copy, 0, right)\r\n    copy.asInstanceOf[Array[T]]\r\n  }\r\n```","created_at":"2018-08-13T06:48:44Z","updated_at":"2018-08-13T06:48:44Z","html_url":"https://github.com/scala/scala/pull/6987#discussion_r209504897","pull_request_url":"https://api.github.com/repos/scala/scala/pulls/6987","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/scala/scala/pulls/comments/209504897"},"html":{"href":"https://github.com/scala/scala/pull/6987#discussion_r209504897"},"pull_request":{"href":"https://api.github.com/repos/scala/scala/pulls/6987"}},"in_reply_to_id":207324943},"pull_request":{"url":"https://api.github.com/repos/scala/scala/pulls/6987","id":204411880,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA0NDExODgw","html_url":"https://github.com/scala/scala/pull/6987","diff_url":"https://github.com/scala/scala/pull/6987.diff","patch_url":"https://github.com/scala/scala/pull/6987.patch","issue_url":"https://api.github.com/repos/scala/scala/issues/6987","number":6987,"state":"open","locked":false,"title":"improvements to Vector performance [ci: last-only]","user":{"login":"mkeskells","id":22275557,"node_id":"MDQ6VXNlcjIyMjc1NTU3","avatar_url":"https://avatars2.githubusercontent.com/u/22275557?v=4","gravatar_id":"","url":"https://api.github.com/users/mkeskells","html_url":"https://github.com/mkeskells","followers_url":"https://api.github.com/users/mkeskells/followers","following_url":"https://api.github.com/users/mkeskells/following{/other_user}","gists_url":"https://api.github.com/users/mkeskells/gists{/gist_id}","starred_url":"https://api.github.com/users/mkeskells/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mkeskells/subscriptions","organizations_url":"https://api.github.com/users/mkeskells/orgs","repos_url":"https://api.github.com/users/mkeskells/repos","events_url":"https://api.github.com/users/mkeskells/events{/privacy}","received_events_url":"https://api.github.com/users/mkeskells/received_events","type":"User","site_admin":false},"body":"some commits from https://github.com/scala/scala/pull/6833 to aid review\r\n\r\n\r\nthis is mostly the Vector related changes and the improvements around drop for IndexedSeq","created_at":"2018-07-27T12:01:38Z","updated_at":"2018-08-13T06:48:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c02387b16de960846109531e3d58a94d4373f43b","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":612660554,"node_id":"MDU6TGFiZWw2MTI2NjA1NTQ=","url":"https://api.github.com/repos/scala/scala/labels/performance","name":"performance","color":"c2e0c6","default":false}],"milestone":{"url":"https://api.github.com/repos/scala/scala/milestones/67","html_url":"https://github.com/scala/scala/milestone/67","labels_url":"https://api.github.com/repos/scala/scala/milestones/67/labels","id":2719691,"node_id":"MDk6TWlsZXN0b25lMjcxOTY5MQ==","number":67,"title":"2.13.0-RC1","description":"Merge to 2.13.x. Restricted to fixes directly improving the collections, their usage or the migration to 2.13.0. We will also consider fixes for important regressions since 2.12.\r\n\r\nAn exception may be made for a small addition that cannot target 2.13.1 due to binary incompatibilities.","creator":{"login":"adriaanm","id":91083,"node_id":"MDQ6VXNlcjkxMDgz","avatar_url":"https://avatars2.githubusercontent.com/u/91083?v=4","gravatar_id":"","url":"https://api.github.com/users/adriaanm","html_url":"https://github.com/adriaanm","followers_url":"https://api.github.com/users/adriaanm/followers","following_url":"https://api.github.com/users/adriaanm/following{/other_user}","gists_url":"https://api.github.com/users/adriaanm/gists{/gist_id}","starred_url":"https://api.github.com/users/adriaanm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adriaanm/subscriptions","organizations_url":"https://api.github.com/users/adriaanm/orgs","repos_url":"https://api.github.com/users/adriaanm/repos","events_url":"https://api.github.com/users/adriaanm/events{/privacy}","received_events_url":"https://api.github.com/users/adriaanm/received_events","type":"User","site_admin":false},"open_issues":27,"closed_issues":1,"state":"open","created_at":"2017-08-23T23:45:52Z","updated_at":"2018-08-13T05:34:09Z","due_on":"2018-09-28T07:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/scala/scala/pulls/6987/commits","review_comments_url":"https://api.github.com/repos/scala/scala/pulls/6987/comments","review_comment_url":"https://api.github.com/repos/scala/scala/pulls/comments{/number}","comments_url":"https://api.github.com/repos/scala/scala/issues/6987/comments","statuses_url":"https://api.github.com/repos/scala/scala/statuses/9ad4ff90114cc93804172e9f1ef7236443a69697","head":{"label":"rorygraves:mike/2.13.x_Vector_speedup","ref":"mike/2.13.x_Vector_speedup","sha":"9ad4ff90114cc93804172e9f1ef7236443a69697","user":{"login":"rorygraves","id":2352078,"node_id":"MDQ6VXNlcjIzNTIwNzg=","avatar_url":"https://avatars2.githubusercontent.com/u/2352078?v=4","gravatar_id":"","url":"https://api.github.com/users/rorygraves","html_url":"https://github.com/rorygraves","followers_url":"https://api.github.com/users/rorygraves/followers","following_url":"https://api.github.com/users/rorygraves/following{/other_user}","gists_url":"https://api.github.com/users/rorygraves/gists{/gist_id}","starred_url":"https://api.github.com/users/rorygraves/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rorygraves/subscriptions","organizations_url":"https://api.github.com/users/rorygraves/orgs","repos_url":"https://api.github.com/users/rorygraves/repos","events_url":"https://api.github.com/users/rorygraves/events{/privacy}","received_events_url":"https://api.github.com/users/rorygraves/received_events","type":"User","site_admin":false},"repo":{"id":77251980,"node_id":"MDEwOlJlcG9zaXRvcnk3NzI1MTk4MA==","name":"scalac_perf","full_name":"rorygraves/scalac_perf","owner":{"login":"rorygraves","id":2352078,"node_id":"MDQ6VXNlcjIzNTIwNzg=","avatar_url":"https://avatars2.githubusercontent.com/u/2352078?v=4","gravatar_id":"","url":"https://api.github.com/users/rorygraves","html_url":"https://github.com/rorygraves","followers_url":"https://api.github.com/users/rorygraves/followers","following_url":"https://api.github.com/users/rorygraves/following{/other_user}","gists_url":"https://api.github.com/users/rorygraves/gists{/gist_id}","starred_url":"https://api.github.com/users/rorygraves/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rorygraves/subscriptions","organizations_url":"https://api.github.com/users/rorygraves/orgs","repos_url":"https://api.github.com/users/rorygraves/repos","events_url":"https://api.github.com/users/rorygraves/events{/privacy}","received_events_url":"https://api.github.com/users/rorygraves/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rorygraves/scalac_perf","description":"The Scala programming language","fork":true,"url":"https://api.github.com/repos/rorygraves/scalac_perf","forks_url":"https://api.github.com/repos/rorygraves/scalac_perf/forks","keys_url":"https://api.github.com/repos/rorygraves/scalac_perf/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rorygraves/scalac_perf/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rorygraves/scalac_perf/teams","hooks_url":"https://api.github.com/repos/rorygraves/scalac_perf/hooks","issue_events_url":"https://api.github.com/repos/rorygraves/scalac_perf/issues/events{/number}","events_url":"https://api.github.com/repos/rorygraves/scalac_perf/events","assignees_url":"https://api.github.com/repos/rorygraves/scalac_perf/assignees{/user}","branches_url":"https://api.github.com/repos/rorygraves/scalac_perf/branches{/branch}","tags_url":"https://api.github.com/repos/rorygraves/scalac_perf/tags","blobs_url":"https://api.github.com/repos/rorygraves/scalac_perf/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rorygraves/scalac_perf/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rorygraves/scalac_perf/git/refs{/sha}","trees_url":"https://api.github.com/repos/rorygraves/scalac_perf/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rorygraves/scalac_perf/statuses/{sha}","languages_url":"https://api.github.com/repos/rorygraves/scalac_perf/languages","stargazers_url":"https://api.github.com/repos/rorygraves/scalac_perf/stargazers","contributors_url":"https://api.github.com/repos/rorygraves/scalac_perf/contributors","subscribers_url":"https://api.github.com/repos/rorygraves/scalac_perf/subscribers","subscription_url":"https://api.github.com/repos/rorygraves/scalac_perf/subscription","commits_url":"https://api.github.com/repos/rorygraves/scalac_perf/commits{/sha}","git_commits_url":"https://api.github.com/repos/rorygraves/scalac_perf/git/commits{/sha}","comments_url":"https://api.github.com/repos/rorygraves/scalac_perf/comments{/number}","issue_comment_url":"https://api.github.com/repos/rorygraves/scalac_perf/issues/comments{/number}","contents_url":"https://api.github.com/repos/rorygraves/scalac_perf/contents/{+path}","compare_url":"https://api.github.com/repos/rorygraves/scalac_perf/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rorygraves/scalac_perf/merges","archive_url":"https://api.github.com/repos/rorygraves/scalac_perf/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rorygraves/scalac_perf/downloads","issues_url":"https://api.github.com/repos/rorygraves/scalac_perf/issues{/number}","pulls_url":"https://api.github.com/repos/rorygraves/scalac_perf/pulls{/number}","milestones_url":"https://api.github.com/repos/rorygraves/scalac_perf/milestones{/number}","notifications_url":"https://api.github.com/repos/rorygraves/scalac_perf/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rorygraves/scalac_perf/labels{/name}","releases_url":"https://api.github.com/repos/rorygraves/scalac_perf/releases{/id}","deployments_url":"https://api.github.com/repos/rorygraves/scalac_perf/deployments","created_at":"2016-12-23T21:42:18Z","updated_at":"2018-04-21T16:11:20Z","pushed_at":"2018-08-13T00:38:17Z","git_url":"git://github.com/rorygraves/scalac_perf.git","ssh_url":"git@github.com:rorygraves/scalac_perf.git","clone_url":"https://github.com/rorygraves/scalac_perf.git","svn_url":"https://github.com/rorygraves/scalac_perf","homepage":"http://www.scala-lang.org/","size":134936,"stargazers_count":15,"watchers_count":15,"language":null,"has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"archived":false,"open_issues_count":51,"license":null,"forks":4,"open_issues":51,"watchers":15,"default_branch":"readme"}},"base":{"label":"scala:2.13.x","ref":"2.13.x","sha":"a3da6cf47111a1f9cef5646e670ffb09f19394e4","user":{"login":"scala","id":57059,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU3MDU5","avatar_url":"https://avatars2.githubusercontent.com/u/57059?v=4","gravatar_id":"","url":"https://api.github.com/users/scala","html_url":"https://github.com/scala","followers_url":"https://api.github.com/users/scala/followers","following_url":"https://api.github.com/users/scala/following{/other_user}","gists_url":"https://api.github.com/users/scala/gists{/gist_id}","starred_url":"https://api.github.com/users/scala/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scala/subscriptions","organizations_url":"https://api.github.com/users/scala/orgs","repos_url":"https://api.github.com/users/scala/repos","events_url":"https://api.github.com/users/scala/events{/privacy}","received_events_url":"https://api.github.com/users/scala/received_events","type":"Organization","site_admin":false},"repo":{"id":2888818,"node_id":"MDEwOlJlcG9zaXRvcnkyODg4ODE4","name":"scala","full_name":"scala/scala","owner":{"login":"scala","id":57059,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU3MDU5","avatar_url":"https://avatars2.githubusercontent.com/u/57059?v=4","gravatar_id":"","url":"https://api.github.com/users/scala","html_url":"https://github.com/scala","followers_url":"https://api.github.com/users/scala/followers","following_url":"https://api.github.com/users/scala/following{/other_user}","gists_url":"https://api.github.com/users/scala/gists{/gist_id}","starred_url":"https://api.github.com/users/scala/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scala/subscriptions","organizations_url":"https://api.github.com/users/scala/orgs","repos_url":"https://api.github.com/users/scala/repos","events_url":"https://api.github.com/users/scala/events{/privacy}","received_events_url":"https://api.github.com/users/scala/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/scala/scala","description":"The Scala programming language","fork":false,"url":"https://api.github.com/repos/scala/scala","forks_url":"https://api.github.com/repos/scala/scala/forks","keys_url":"https://api.github.com/repos/scala/scala/keys{/key_id}","collaborators_url":"https://api.github.com/repos/scala/scala/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/scala/scala/teams","hooks_url":"https://api.github.com/repos/scala/scala/hooks","issue_events_url":"https://api.github.com/repos/scala/scala/issues/events{/number}","events_url":"https://api.github.com/repos/scala/scala/events","assignees_url":"https://api.github.com/repos/scala/scala/assignees{/user}","branches_url":"https://api.github.com/repos/scala/scala/branches{/branch}","tags_url":"https://api.github.com/repos/scala/scala/tags","blobs_url":"https://api.github.com/repos/scala/scala/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/scala/scala/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/scala/scala/git/refs{/sha}","trees_url":"https://api.github.com/repos/scala/scala/git/trees{/sha}","statuses_url":"https://api.github.com/repos/scala/scala/statuses/{sha}","languages_url":"https://api.github.com/repos/scala/scala/languages","stargazers_url":"https://api.github.com/repos/scala/scala/stargazers","contributors_url":"https://api.github.com/repos/scala/scala/contributors","subscribers_url":"https://api.github.com/repos/scala/scala/subscribers","subscription_url":"https://api.github.com/repos/scala/scala/subscription","commits_url":"https://api.github.com/repos/scala/scala/commits{/sha}","git_commits_url":"https://api.github.com/repos/scala/scala/git/commits{/sha}","comments_url":"https://api.github.com/repos/scala/scala/comments{/number}","issue_comment_url":"https://api.github.com/repos/scala/scala/issues/comments{/number}","contents_url":"https://api.github.com/repos/scala/scala/contents/{+path}","compare_url":"https://api.github.com/repos/scala/scala/compare/{base}...{head}","merges_url":"https://api.github.com/repos/scala/scala/merges","archive_url":"https://api.github.com/repos/scala/scala/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/scala/scala/downloads","issues_url":"https://api.github.com/repos/scala/scala/issues{/number}","pulls_url":"https://api.github.com/repos/scala/scala/pulls{/number}","milestones_url":"https://api.github.com/repos/scala/scala/milestones{/number}","notifications_url":"https://api.github.com/repos/scala/scala/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/scala/scala/labels{/name}","releases_url":"https://api.github.com/repos/scala/scala/releases{/id}","deployments_url":"https://api.github.com/repos/scala/scala/deployments","created_at":"2011-12-01T05:02:34Z","updated_at":"2018-08-13T06:24:08Z","pushed_at":"2018-08-13T05:34:09Z","git_url":"git://github.com/scala/scala.git","ssh_url":"git@github.com:scala/scala.git","clone_url":"https://github.com/scala/scala.git","svn_url":"https://github.com/scala/scala","homepage":"http://www.scala-lang.org/","size":101783,"stargazers_count":10536,"watchers_count":10536,"language":"Scala","has_issues":false,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":2491,"mirror_url":null,"archived":false,"open_issues_count":68,"license":{"key":"bsd-3-clause","name":"BSD 3-Clause \"New\" or \"Revised\" License","spdx_id":"BSD-3-Clause","url":"https://api.github.com/licenses/bsd-3-clause","node_id":"MDc6TGljZW5zZTU="},"forks":2491,"open_issues":68,"watchers":10536,"default_branch":"2.13.x"}},"_links":{"self":{"href":"https://api.github.com/repos/scala/scala/pulls/6987"},"html":{"href":"https://github.com/scala/scala/pull/6987"},"issue":{"href":"https://api.github.com/repos/scala/scala/issues/6987"},"comments":{"href":"https://api.github.com/repos/scala/scala/issues/6987/comments"},"review_comments":{"href":"https://api.github.com/repos/scala/scala/pulls/6987/comments"},"review_comment":{"href":"https://api.github.com/repos/scala/scala/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/scala/scala/pulls/6987/commits"},"statuses":{"href":"https://api.github.com/repos/scala/scala/statuses/9ad4ff90114cc93804172e9f1ef7236443a69697"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"retronym"}}