{"action":"created","comment":{"url":"https://api.github.com/repos/Microsoft/visualfsharp/pulls/comments/199341089","pull_request_review_id":133445494,"id":199341089,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5OTM0MTA4OQ==","diff_hunk":"@@ -744,7 +744,101 @@ namespace Microsoft.FSharp.Core\n         let anyToStringShowingNull x = anyToString \"null\" x\n \n         module HashCompare = \n-        \n+            //-------------------------------------------------------------------------\n+            // LanguagePrimitives.HashCompare: HASHING.  \n+            //------------------------------------------------------------------------- \n+            let defaultHashNodes = 18 \n+\n+            /// The implementation of IEqualityComparer, using depth-limited for hashing and PER semantics for NaN equality.\n+            type CountLimitedHasherPER(sz:int) =\n+                [<DefaultValue>]\n+                val mutable nodeCount : int\n+                \n+                member x.Fresh() = \n+                    if (System.Threading.Interlocked.CompareExchange(&(x.nodeCount), sz, 0) = 0) then \n+                        x\n+                    else\n+                        new CountLimitedHasherPER(sz)\n+                \n+                interface IEqualityComparer \n+\n+            /// The implementation of IEqualityComparer, using unlimited depth for hashing and ER semantics for NaN equality.\n+            type UnlimitedHasherER() =\n+                interface IEqualityComparer \n+                \n+            /// The implementation of IEqualityComparer, using unlimited depth for hashing and PER semantics for NaN equality.\n+            type UnlimitedHasherPER() =\n+                interface IEqualityComparer\n+                    \n+\n+            /// The unique object for unlimited depth for hashing and ER semantics for equality.\n+            let fsEqualityComparerUnlimitedHashingER = UnlimitedHasherER()\n+\n+            /// The unique object for unlimited depth for hashing and PER semantics for equality.\n+            let fsEqualityComparerUnlimitedHashingPER = UnlimitedHasherPER()\n+                     \n+            let inline HashCombine nr x y = (x <<< 1) + y + 631 * nr\n+\n+            let inline ArrayHashing<'element,'array when 'array :> System.Array> get lowerBound (f:'element->int) (x:'array) : int =\n+                let rec loop acc i =\n+                    if i < lowerBound then acc\n+                    else loop (HashCombine i acc (f (get x i))) (i-1)\n+                \n+                let lastIdx =\n+                    let upperBound = lowerBound+defaultHashNodes\n+                    match lowerBound+x.Length-1 with\n+                    | oversized when oversized > upperBound -> upperBound\n+                    | good -> good\n+\n+                loop 0 lastIdx \n+\n+            let GenericHashObjArray   (iec:System.Collections.IEqualityComparer) (x:obj[]) = ArrayHashing get 0 iec.GetHashCode x\n+            let GenericHashByteArray  (x:byte[])  = ArrayHashing get 0 intOfByte x\n+            let GenericHashInt32Array (x:int32[]) = ArrayHashing get 0 (fun x -> x) x\n+            let GenericHashInt64Array (x:int64[]) = ArrayHashing get 0 int32 x\n+\n+            // special case - arrays do not by default have a decent structural hashing function\n+            let GenericHashArbArray (iec : System.Collections.IEqualityComparer) (x: System.Array) : int =\n+                match x.Rank with \n+                | 1 -> ArrayHashing (fun a i -> a.GetValue i) (x.GetLowerBound 0) iec.GetHashCode x\n+                | _ -> HashCombine 10 (x.GetLength(0)) (x.GetLength(1)) \n+\n+            // Core implementation of structural hashing, corresponds to pseudo-code in the \n+            // F# Language spec.  Searches for the IStructuralHash interface, otherwise uses GetHashCode().\n+            // Arrays are structurally hashed through a separate technique.\n+            //\n+            // \"iec\" is either fsEqualityComparerUnlimitedHashingER, fsEqualityComparerUnlimitedHashingPER or a CountLimitedHasherPER.\n+            let rec GenericHashParamObj (iec : System.Collections.IEqualityComparer) (x: obj) : int =\n+                  match x with \n+                  | null -> 0 \n+                  | (:? System.Array as a) -> \n+                      match a with \n+                      | :? (obj[]) as oa -> GenericHashObjArray iec oa \n+                      | :? (byte[]) as ba -> GenericHashByteArray ba ","path":"src/fsharp/FSharp.Core/prim-types.fs","position":75,"original_position":75,"commit_id":"63d76b9aadb37fd548526bf6542bc331d2cfc839","original_commit_id":"63d76b9aadb37fd548526bf6542bc331d2cfc839","user":{"login":"vasily-kirichenko","id":873919,"node_id":"MDQ6VXNlcjg3MzkxOQ==","avatar_url":"https://avatars2.githubusercontent.com/u/873919?v=4","gravatar_id":"","url":"https://api.github.com/users/vasily-kirichenko","html_url":"https://github.com/vasily-kirichenko","followers_url":"https://api.github.com/users/vasily-kirichenko/followers","following_url":"https://api.github.com/users/vasily-kirichenko/following{/other_user}","gists_url":"https://api.github.com/users/vasily-kirichenko/gists{/gist_id}","starred_url":"https://api.github.com/users/vasily-kirichenko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vasily-kirichenko/subscriptions","organizations_url":"https://api.github.com/users/vasily-kirichenko/orgs","repos_url":"https://api.github.com/users/vasily-kirichenko/repos","events_url":"https://api.github.com/users/vasily-kirichenko/events{/privacy}","received_events_url":"https://api.github.com/users/vasily-kirichenko/received_events","type":"User","site_admin":false},"body":"`sbyte[]` will match on this branch as well. Are you sure `GenericHashByteArray` will produce correct result in this case?","created_at":"2018-07-01T07:46:58Z","updated_at":"2018-07-01T07:46:58Z","html_url":"https://github.com/Microsoft/visualfsharp/pull/5278#discussion_r199341089","pull_request_url":"https://api.github.com/repos/Microsoft/visualfsharp/pulls/5278","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/Microsoft/visualfsharp/pulls/comments/199341089"},"html":{"href":"https://github.com/Microsoft/visualfsharp/pull/5278#discussion_r199341089"},"pull_request":{"href":"https://api.github.com/repos/Microsoft/visualfsharp/pulls/5278"}}},"pull_request":{"url":"https://api.github.com/repos/Microsoft/visualfsharp/pulls/5278","id":198511648,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk4NTExNjQ4","html_url":"https://github.com/Microsoft/visualfsharp/pull/5278","diff_url":"https://github.com/Microsoft/visualfsharp/pull/5278.diff","patch_url":"https://github.com/Microsoft/visualfsharp/pull/5278.patch","issue_url":"https://api.github.com/repos/Microsoft/visualfsharp/issues/5278","number":5278,"state":"open","locked":false,"title":"[WIP] [CompilerPerf] Extends #5112 ideas to Comparers (i.e >, >=, <, <= and LanguagePrimitives.FastGenericComparer)","user":{"login":"manofstick","id":2093966,"node_id":"MDQ6VXNlcjIwOTM5NjY=","avatar_url":"https://avatars0.githubusercontent.com/u/2093966?v=4","gravatar_id":"","url":"https://api.github.com/users/manofstick","html_url":"https://github.com/manofstick","followers_url":"https://api.github.com/users/manofstick/followers","following_url":"https://api.github.com/users/manofstick/following{/other_user}","gists_url":"https://api.github.com/users/manofstick/gists{/gist_id}","starred_url":"https://api.github.com/users/manofstick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/manofstick/subscriptions","organizations_url":"https://api.github.com/users/manofstick/orgs","repos_url":"https://api.github.com/users/manofstick/repos","events_url":"https://api.github.com/users/manofstick/events{/privacy}","received_events_url":"https://api.github.com/users/manofstick/received_events","type":"User","site_admin":false},"body":"*This is a standalone improvement, as is #5112, but this is branched off the tail of that PR as I see it being approved and integrated first, as this is still currently a WIP.*\r\n","created_at":"2018-07-01T07:28:52Z","updated_at":"2018-07-01T07:46:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/Microsoft/visualfsharp/pulls/5278/commits","review_comments_url":"https://api.github.com/repos/Microsoft/visualfsharp/pulls/5278/comments","review_comment_url":"https://api.github.com/repos/Microsoft/visualfsharp/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Microsoft/visualfsharp/issues/5278/comments","statuses_url":"https://api.github.com/repos/Microsoft/visualfsharp/statuses/63d76b9aadb37fd548526bf6542bc331d2cfc839","head":{"label":"manofstick:nobox_comparer","ref":"nobox_comparer","sha":"63d76b9aadb37fd548526bf6542bc331d2cfc839","user":{"login":"manofstick","id":2093966,"node_id":"MDQ6VXNlcjIwOTM5NjY=","avatar_url":"https://avatars0.githubusercontent.com/u/2093966?v=4","gravatar_id":"","url":"https://api.github.com/users/manofstick","html_url":"https://github.com/manofstick","followers_url":"https://api.github.com/users/manofstick/followers","following_url":"https://api.github.com/users/manofstick/following{/other_user}","gists_url":"https://api.github.com/users/manofstick/gists{/gist_id}","starred_url":"https://api.github.com/users/manofstick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/manofstick/subscriptions","organizations_url":"https://api.github.com/users/manofstick/orgs","repos_url":"https://api.github.com/users/manofstick/repos","events_url":"https://api.github.com/users/manofstick/events{/privacy}","received_events_url":"https://api.github.com/users/manofstick/received_events","type":"User","site_admin":false},"repo":{"id":66444883,"node_id":"MDEwOlJlcG9zaXRvcnk2NjQ0NDg4Mw==","name":"visualfsharp","full_name":"manofstick/visualfsharp","owner":{"login":"manofstick","id":2093966,"node_id":"MDQ6VXNlcjIwOTM5NjY=","avatar_url":"https://avatars0.githubusercontent.com/u/2093966?v=4","gravatar_id":"","url":"https://api.github.com/users/manofstick","html_url":"https://github.com/manofstick","followers_url":"https://api.github.com/users/manofstick/followers","following_url":"https://api.github.com/users/manofstick/following{/other_user}","gists_url":"https://api.github.com/users/manofstick/gists{/gist_id}","starred_url":"https://api.github.com/users/manofstick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/manofstick/subscriptions","organizations_url":"https://api.github.com/users/manofstick/orgs","repos_url":"https://api.github.com/users/manofstick/repos","events_url":"https://api.github.com/users/manofstick/events{/privacy}","received_events_url":"https://api.github.com/users/manofstick/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/manofstick/visualfsharp","description":"The Visual F# compiler and tools","fork":true,"url":"https://api.github.com/repos/manofstick/visualfsharp","forks_url":"https://api.github.com/repos/manofstick/visualfsharp/forks","keys_url":"https://api.github.com/repos/manofstick/visualfsharp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/manofstick/visualfsharp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/manofstick/visualfsharp/teams","hooks_url":"https://api.github.com/repos/manofstick/visualfsharp/hooks","issue_events_url":"https://api.github.com/repos/manofstick/visualfsharp/issues/events{/number}","events_url":"https://api.github.com/repos/manofstick/visualfsharp/events","assignees_url":"https://api.github.com/repos/manofstick/visualfsharp/assignees{/user}","branches_url":"https://api.github.com/repos/manofstick/visualfsharp/branches{/branch}","tags_url":"https://api.github.com/repos/manofstick/visualfsharp/tags","blobs_url":"https://api.github.com/repos/manofstick/visualfsharp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/manofstick/visualfsharp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/manofstick/visualfsharp/git/refs{/sha}","trees_url":"https://api.github.com/repos/manofstick/visualfsharp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/manofstick/visualfsharp/statuses/{sha}","languages_url":"https://api.github.com/repos/manofstick/visualfsharp/languages","stargazers_url":"https://api.github.com/repos/manofstick/visualfsharp/stargazers","contributors_url":"https://api.github.com/repos/manofstick/visualfsharp/contributors","subscribers_url":"https://api.github.com/repos/manofstick/visualfsharp/subscribers","subscription_url":"https://api.github.com/repos/manofstick/visualfsharp/subscription","commits_url":"https://api.github.com/repos/manofstick/visualfsharp/commits{/sha}","git_commits_url":"https://api.github.com/repos/manofstick/visualfsharp/git/commits{/sha}","comments_url":"https://api.github.com/repos/manofstick/visualfsharp/comments{/number}","issue_comment_url":"https://api.github.com/repos/manofstick/visualfsharp/issues/comments{/number}","contents_url":"https://api.github.com/repos/manofstick/visualfsharp/contents/{+path}","compare_url":"https://api.github.com/repos/manofstick/visualfsharp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/manofstick/visualfsharp/merges","archive_url":"https://api.github.com/repos/manofstick/visualfsharp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/manofstick/visualfsharp/downloads","issues_url":"https://api.github.com/repos/manofstick/visualfsharp/issues{/number}","pulls_url":"https://api.github.com/repos/manofstick/visualfsharp/pulls{/number}","milestones_url":"https://api.github.com/repos/manofstick/visualfsharp/milestones{/number}","notifications_url":"https://api.github.com/repos/manofstick/visualfsharp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/manofstick/visualfsharp/labels{/name}","releases_url":"https://api.github.com/repos/manofstick/visualfsharp/releases{/id}","deployments_url":"https://api.github.com/repos/manofstick/visualfsharp/deployments","created_at":"2016-08-24T08:14:41Z","updated_at":"2016-09-21T04:43:48Z","pushed_at":"2018-07-01T07:20:25Z","git_url":"git://github.com/manofstick/visualfsharp.git","ssh_url":"git@github.com:manofstick/visualfsharp.git","clone_url":"https://github.com/manofstick/visualfsharp.git","svn_url":"https://github.com/manofstick/visualfsharp","homepage":null,"size":119549,"stargazers_count":0,"watchers_count":0,"language":"F#","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Microsoft:master","ref":"master","sha":"62068b73d6fdd11b47b516dda7023e0f92f78d8d","user":{"login":"Microsoft","id":6154722,"node_id":"MDEyOk9yZ2FuaXphdGlvbjYxNTQ3MjI=","avatar_url":"https://avatars2.githubusercontent.com/u/6154722?v=4","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"repo":{"id":29048891,"node_id":"MDEwOlJlcG9zaXRvcnkyOTA0ODg5MQ==","name":"visualfsharp","full_name":"Microsoft/visualfsharp","owner":{"login":"Microsoft","id":6154722,"node_id":"MDEyOk9yZ2FuaXphdGlvbjYxNTQ3MjI=","avatar_url":"https://avatars2.githubusercontent.com/u/6154722?v=4","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Microsoft/visualfsharp","description":"The Visual F# compiler and tools","fork":false,"url":"https://api.github.com/repos/Microsoft/visualfsharp","forks_url":"https://api.github.com/repos/Microsoft/visualfsharp/forks","keys_url":"https://api.github.com/repos/Microsoft/visualfsharp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Microsoft/visualfsharp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Microsoft/visualfsharp/teams","hooks_url":"https://api.github.com/repos/Microsoft/visualfsharp/hooks","issue_events_url":"https://api.github.com/repos/Microsoft/visualfsharp/issues/events{/number}","events_url":"https://api.github.com/repos/Microsoft/visualfsharp/events","assignees_url":"https://api.github.com/repos/Microsoft/visualfsharp/assignees{/user}","branches_url":"https://api.github.com/repos/Microsoft/visualfsharp/branches{/branch}","tags_url":"https://api.github.com/repos/Microsoft/visualfsharp/tags","blobs_url":"https://api.github.com/repos/Microsoft/visualfsharp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Microsoft/visualfsharp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Microsoft/visualfsharp/git/refs{/sha}","trees_url":"https://api.github.com/repos/Microsoft/visualfsharp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Microsoft/visualfsharp/statuses/{sha}","languages_url":"https://api.github.com/repos/Microsoft/visualfsharp/languages","stargazers_url":"https://api.github.com/repos/Microsoft/visualfsharp/stargazers","contributors_url":"https://api.github.com/repos/Microsoft/visualfsharp/contributors","subscribers_url":"https://api.github.com/repos/Microsoft/visualfsharp/subscribers","subscription_url":"https://api.github.com/repos/Microsoft/visualfsharp/subscription","commits_url":"https://api.github.com/repos/Microsoft/visualfsharp/commits{/sha}","git_commits_url":"https://api.github.com/repos/Microsoft/visualfsharp/git/commits{/sha}","comments_url":"https://api.github.com/repos/Microsoft/visualfsharp/comments{/number}","issue_comment_url":"https://api.github.com/repos/Microsoft/visualfsharp/issues/comments{/number}","contents_url":"https://api.github.com/repos/Microsoft/visualfsharp/contents/{+path}","compare_url":"https://api.github.com/repos/Microsoft/visualfsharp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Microsoft/visualfsharp/merges","archive_url":"https://api.github.com/repos/Microsoft/visualfsharp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Microsoft/visualfsharp/downloads","issues_url":"https://api.github.com/repos/Microsoft/visualfsharp/issues{/number}","pulls_url":"https://api.github.com/repos/Microsoft/visualfsharp/pulls{/number}","milestones_url":"https://api.github.com/repos/Microsoft/visualfsharp/milestones{/number}","notifications_url":"https://api.github.com/repos/Microsoft/visualfsharp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Microsoft/visualfsharp/labels{/name}","releases_url":"https://api.github.com/repos/Microsoft/visualfsharp/releases{/id}","deployments_url":"https://api.github.com/repos/Microsoft/visualfsharp/deployments","created_at":"2015-01-10T05:58:43Z","updated_at":"2018-06-30T21:22:19Z","pushed_at":"2018-07-01T07:37:15Z","git_url":"git://github.com/Microsoft/visualfsharp.git","ssh_url":"git@github.com:Microsoft/visualfsharp.git","clone_url":"https://github.com/Microsoft/visualfsharp.git","svn_url":"https://github.com/Microsoft/visualfsharp","homepage":null,"size":122727,"stargazers_count":1328,"watchers_count":1328,"language":"F#","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":357,"mirror_url":null,"archived":false,"open_issues_count":674,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":357,"open_issues":674,"watchers":1328,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Microsoft/visualfsharp/pulls/5278"},"html":{"href":"https://github.com/Microsoft/visualfsharp/pull/5278"},"issue":{"href":"https://api.github.com/repos/Microsoft/visualfsharp/issues/5278"},"comments":{"href":"https://api.github.com/repos/Microsoft/visualfsharp/issues/5278/comments"},"review_comments":{"href":"https://api.github.com/repos/Microsoft/visualfsharp/pulls/5278/comments"},"review_comment":{"href":"https://api.github.com/repos/Microsoft/visualfsharp/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Microsoft/visualfsharp/pulls/5278/commits"},"statuses":{"href":"https://api.github.com/repos/Microsoft/visualfsharp/statuses/63d76b9aadb37fd548526bf6542bc331d2cfc839"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"vasily-kirichenko"}}