{"action":"created","comment":{"url":"https://api.github.com/repos/scala/scala/pulls/comments/76590654","id":76590654,"diff_hunk":"@@ -96,6 +96,12 @@ trait GenTraversableOnce[+A] extends Any {\n    */\n   def size: Int\n \n+   /** The size of this $coll if it is can be cheaply computed\n+   *\n+   *  @return    the number of elements in this $coll, or -1 if the size cannot be determined cheaply\n+   */\n+  protected[collection] def sizeHint: Int = -1","path":"src/library/scala/collection/GenTraversableOnce.scala","position":8,"original_position":8,"commit_id":"abc4680fdaa7ef3cbd6ec77be6c33a9025e618c4","original_commit_id":"abc4680fdaa7ef3cbd6ec77be6c33a9025e618c4","user":{"login":"retronym","id":65551,"avatar_url":"https://avatars.githubusercontent.com/u/65551?v=3","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":"> I'm not sure about restricting the visibility of this method.\r\n\r\nI was mostly being conservative about offering this for public consumption.","created_at":"2016-08-29T11:16:58Z","updated_at":"2016-08-29T11:16:58Z","html_url":"https://github.com/scala/scala/pull/5364#discussion_r76590654","pull_request_url":"https://api.github.com/repos/scala/scala/pulls/5364","_links":{"self":{"href":"https://api.github.com/repos/scala/scala/pulls/comments/76590654"},"html":{"href":"https://github.com/scala/scala/pull/5364#discussion_r76590654"},"pull_request":{"href":"https://api.github.com/repos/scala/scala/pulls/5364"}}},"pull_request":{"url":"https://api.github.com/repos/scala/scala/pulls/5364","id":83031966,"html_url":"https://github.com/scala/scala/pull/5364","diff_url":"https://github.com/scala/scala/pull/5364.diff","patch_url":"https://github.com/scala/scala/pull/5364.patch","issue_url":"https://api.github.com/repos/scala/scala/issues/5364","number":5364,"state":"open","locked":false,"title":"SI-9823 Collections perf: favor virtual call over instanceof","user":{"login":"retronym","id":65551,"avatar_url":"https://avatars.githubusercontent.com/u/65551?v=3","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":"This avoids concurrent usages of collections in NUMA architectures\nfrom falling of a performance cliff due to an implementation detail\nof interface instanceof checks in HotSpot JVM.\n\nThe VM contains a one element cache in the metadata of each class\nto record the most recent successful test for a interface.\n\nFor example:\n\n    classOf[Serializable].isAssignableFrom(classOf[Some[_]])\n\nWould, in addition to returning `true`, set:\n\n    classOf[Some[_]]._secondary_super_cache = classOf[Serializable]\n\nThis is done to hide the fact that interface tests are O(N),\nwhere N is the number of inherited interfaces.\n\nThis scheme is discussed in \"Fast Subtype Checking for the\nHotSpot JVM\" (Click, Rose) [1]\n\nHowever, if this cache repeatedly misses, not only are we\nexposed to the linear search of the secondary super type array,\nbut we are also required to write back to the cache. If other\ncores are operating on the same cache line, this can lead to\na significant slowdown (\"cache thrashing\"). This effect will\nby most (or only?) visible on multi socket machines.\n\nThe pathological case is:\n\n    scala> Iterator.continually(List(classOf[Product], classOf[Serializable])).flatten.take(100).map(intf => intf.isAssignableFrom(classOf[Some[_]])).count(x => x)\n    res19: Int = 100\n\nWhich, if run on a multi-socket machine, should be much slower\nthan:\n\n    scala> (Iterator.continually(classOf[Product]).take(50) ++ Iterator.continually(classOf[Serializable]).take(50)).map(intf => intf.isAssignableFrom(classOf[Some[_]])).count(x => x)\n    res20: Int = 100\n\nThis commit avoids a interface test in a hot path in the collections\nby instead using virtual dispatch to differentiate between\nIndexedSeqLike and other collections. HotSpot will still use some\nshared bookkeeping (\"inline cache\" [2]) at the callsites of\nthis method, but these stabilize in the megamorphic usage and no\nlonger force expensive cache line synchronization.\n\n[1] https://www.researchgate.net/publication/221552851_Fast_subtype_checking_in_the_HotSpot_JVM\n[2] https://wiki.openjdk.java.net/display/HotSpot/PerformanceTechniques","created_at":"2016-08-29T00:13:23Z","updated_at":"2016-08-29T11:16:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"66a5189fa6737d2f3ff55ab482b6747aea213016","assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/scala/scala/milestones/47","html_url":"https://github.com/scala/scala/milestones/2.12.0-RC1","labels_url":"https://api.github.com/repos/scala/scala/milestones/47/labels","id":977200,"number":47,"title":"2.12.0-RC1","description":"The PR queue for RC1 is now closed. We'll release as soon as the all PRs have been reviewed and merged. Once RC1 is out, we'll branch for 2.12.0.  [Discussion](https://groups.google.com/d/msg/scala-internals/hxDjZfm1h3c/Y5OkHdatAAAJ)\r\n\r\n2.12.1 development will continue on the 2.12.x branch during the RC cycle.\r\n\r\nLead: @adriaanm\r\n\r\nMerge to 2.12.0.","creator":{"login":"adriaanm","id":91083,"avatar_url":"https://avatars.githubusercontent.com/u/91083?v=3","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":4,"closed_issues":84,"state":"open","created_at":"2015-02-12T17:53:06Z","updated_at":"2016-08-29T09:55:33Z","due_on":"2016-08-29T00:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/scala/scala/pulls/5364/commits","review_comments_url":"https://api.github.com/repos/scala/scala/pulls/5364/comments","review_comment_url":"https://api.github.com/repos/scala/scala/pulls/comments{/number}","comments_url":"https://api.github.com/repos/scala/scala/issues/5364/comments","statuses_url":"https://api.github.com/repos/scala/scala/statuses/abc4680fdaa7ef3cbd6ec77be6c33a9025e618c4","head":{"label":"retronym:topic/instanceof-perf-2","ref":"topic/instanceof-perf-2","sha":"abc4680fdaa7ef3cbd6ec77be6c33a9025e618c4","user":{"login":"retronym","id":65551,"avatar_url":"https://avatars.githubusercontent.com/u/65551?v=3","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},"repo":{"id":2902104,"name":"scala","full_name":"retronym/scala","owner":{"login":"retronym","id":65551,"avatar_url":"https://avatars.githubusercontent.com/u/65551?v=3","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},"private":false,"html_url":"https://github.com/retronym/scala","description":"The Scala programming language","fork":true,"url":"https://api.github.com/repos/retronym/scala","forks_url":"https://api.github.com/repos/retronym/scala/forks","keys_url":"https://api.github.com/repos/retronym/scala/keys{/key_id}","collaborators_url":"https://api.github.com/repos/retronym/scala/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/retronym/scala/teams","hooks_url":"https://api.github.com/repos/retronym/scala/hooks","issue_events_url":"https://api.github.com/repos/retronym/scala/issues/events{/number}","events_url":"https://api.github.com/repos/retronym/scala/events","assignees_url":"https://api.github.com/repos/retronym/scala/assignees{/user}","branches_url":"https://api.github.com/repos/retronym/scala/branches{/branch}","tags_url":"https://api.github.com/repos/retronym/scala/tags","blobs_url":"https://api.github.com/repos/retronym/scala/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/retronym/scala/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/retronym/scala/git/refs{/sha}","trees_url":"https://api.github.com/repos/retronym/scala/git/trees{/sha}","statuses_url":"https://api.github.com/repos/retronym/scala/statuses/{sha}","languages_url":"https://api.github.com/repos/retronym/scala/languages","stargazers_url":"https://api.github.com/repos/retronym/scala/stargazers","contributors_url":"https://api.github.com/repos/retronym/scala/contributors","subscribers_url":"https://api.github.com/repos/retronym/scala/subscribers","subscription_url":"https://api.github.com/repos/retronym/scala/subscription","commits_url":"https://api.github.com/repos/retronym/scala/commits{/sha}","git_commits_url":"https://api.github.com/repos/retronym/scala/git/commits{/sha}","comments_url":"https://api.github.com/repos/retronym/scala/comments{/number}","issue_comment_url":"https://api.github.com/repos/retronym/scala/issues/comments{/number}","contents_url":"https://api.github.com/repos/retronym/scala/contents/{+path}","compare_url":"https://api.github.com/repos/retronym/scala/compare/{base}...{head}","merges_url":"https://api.github.com/repos/retronym/scala/merges","archive_url":"https://api.github.com/repos/retronym/scala/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/retronym/scala/downloads","issues_url":"https://api.github.com/repos/retronym/scala/issues{/number}","pulls_url":"https://api.github.com/repos/retronym/scala/pulls{/number}","milestones_url":"https://api.github.com/repos/retronym/scala/milestones{/number}","notifications_url":"https://api.github.com/repos/retronym/scala/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/retronym/scala/labels{/name}","releases_url":"https://api.github.com/repos/retronym/scala/releases{/id}","deployments_url":"https://api.github.com/repos/retronym/scala/deployments","created_at":"2011-12-02T23:04:11Z","updated_at":"2015-05-09T21:40:12Z","pushed_at":"2016-08-29T04:16:55Z","git_url":"git://github.com/retronym/scala.git","ssh_url":"git@github.com:retronym/scala.git","clone_url":"https://github.com/retronym/scala.git","svn_url":"https://github.com/retronym/scala","homepage":"http://www.scala-lang.org/","size":84553,"stargazers_count":5,"watchers_count":5,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":5,"default_branch":"master"}},"base":{"label":"scala:2.12.x","ref":"2.12.x","sha":"18b75748dfb3e790b4c4be67155e2f1682fc85e2","user":{"login":"scala","id":57059,"avatar_url":"https://avatars.githubusercontent.com/u/57059?v=3","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,"name":"scala","full_name":"scala/scala","owner":{"login":"scala","id":57059,"avatar_url":"https://avatars.githubusercontent.com/u/57059?v=3","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":"2016-08-29T09:12:18Z","pushed_at":"2016-08-29T09:55:33Z","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":136008,"stargazers_count":6733,"watchers_count":6733,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":1697,"mirror_url":null,"open_issues_count":56,"forks":1697,"open_issues":56,"watchers":6733,"default_branch":"2.12.x"}},"_links":{"self":{"href":"https://api.github.com/repos/scala/scala/pulls/5364"},"html":{"href":"https://github.com/scala/scala/pull/5364"},"issue":{"href":"https://api.github.com/repos/scala/scala/issues/5364"},"comments":{"href":"https://api.github.com/repos/scala/scala/issues/5364/comments"},"review_comments":{"href":"https://api.github.com/repos/scala/scala/pulls/5364/comments"},"review_comment":{"href":"https://api.github.com/repos/scala/scala/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/scala/scala/pulls/5364/commits"},"statuses":{"href":"https://api.github.com/repos/scala/scala/statuses/abc4680fdaa7ef3cbd6ec77be6c33a9025e618c4"}}}}
{"actor":{"display_login":"retronym"}}