{"action":"created","comment":{"url":"https://api.github.com/repos/rust-lang/rust/pulls/comments/200409368","pull_request_review_id":134704403,"id":200409368,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwMDQwOTM2OA==","diff_hunk":"@@ -0,0 +1,291 @@\n+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT\n+// file at the top-level directory of this distribution and at\n+// http://rust-lang.org/COPYRIGHT.\n+//\n+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or\n+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license\n+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your\n+// option. This file may not be copied, modified, or distributed\n+// except according to those terms.\n+\n+use std::marker::PhantomData;\n+use std::hash::Hash;\n+use std::hash::Hasher;\n+use std::hash::BuildHasher;\n+use std::mem::{self, size_of};\n+use std::ptr::{Unique, NonNull};\n+use std::alloc::{Global, Alloc};\n+use std::collections::hash_map::RandomState;\n+use std::borrow::Borrow;\n+use std::fmt;\n+\n+const ENTRIES_PER_GROUP: usize = 5;\n+\n+#[repr(align(64), C)]\n+pub struct Group {\n+    hashes: [u32; ENTRIES_PER_GROUP],\n+    size: u32,\n+    values: [u64; ENTRIES_PER_GROUP],\n+}\n+\n+impl Group {\n+    #[inline(always)]\n+    fn search_for_empty(&self) -> Option<usize> {\n+        if self.size != ENTRIES_PER_GROUP as u32 {\n+            Some(self.size as usize)\n+        } else {\n+            None\n+        }\n+    }\n+\n+    #[inline(always)]\n+    fn search_with<K, F: FnMut(&K) -> bool>(&self, eq: &mut F, hash: u32) -> Option<(usize, bool)> {\n+        for i in 0..ENTRIES_PER_GROUP {\n+            let h = unsafe { *self.hashes.get_unchecked(i) };\n+            if h == hash && eq(unsafe { mem::transmute(self.values.get_unchecked(i)) }) {\n+                return Some((i, false))\n+            }\n+        }\n+        self.search_for_empty().map(|i| (i, true))\n+    }\n+\n+    #[inline(always)]\n+    fn set(&mut self, pos: usize, hash: u32, value: u64) {\n+        unsafe {\n+            *self.hashes.get_unchecked_mut(pos) = hash;\n+            *self.values.get_unchecked_mut(pos) = value;\n+        }\n+    }\n+\n+    #[inline(always)]\n+    fn iter<F: FnMut(u32, u64)>(&self, f: &mut F) {\n+        for i in 0..ENTRIES_PER_GROUP {\n+            unsafe {\n+                let h = *self.hashes.get_unchecked(i);\n+                if h != 0 {\n+                    f(h, *self.values.get_unchecked(i))\n+                }\n+            }\n+        }\n+    }\n+}\n+\n+pub struct Table {\n+    group_mask: usize,\n+    size: usize,\n+    capacity: usize,\n+    groups: Unique<Group>,\n+}\n+\n+pub struct RawEntry {\n+    group: *mut Group,\n+    pos: usize,\n+    empty: bool\n+}\n+\n+impl Drop for Table {\n+    fn drop(&mut self) {\n+        if self.group_mask == 0 {\n+            return;\n+        }\n+\n+        unsafe {\n+            Global.dealloc_array(\n+                NonNull::new_unchecked(self.groups.as_ptr()),\n+                self.group_mask + 1\n+            ).unwrap();\n+        }\n+    }\n+}\n+\n+impl Table {\n+    fn new(group_count: usize) -> Table {\n+        assert!(size_of::<Group>() == 64);\n+        let groups: NonNull<Group> = Global.alloc_array(group_count).unwrap();\n+        let capacity2 = group_count * ENTRIES_PER_GROUP;\n+        let capacity1 = capacity2 - 1;\n+        //let capacity = (capacity1 * 10 + 10 - 1) / 11;\n+        let capacity = (capacity1 * 10 + 10 - 1) / 13;\n+        //println!(\"capacity1 {} capacity {}\", capacity1, capacity);\n+        assert!(capacity < capacity2);\n+\n+        for i in 0..group_count {","path":"src/librustc_data_structures/interner.rs","position":112,"original_position":112,"commit_id":"c124143736c669f0a3f0ac766434828f92f39378","original_commit_id":"c124143736c669f0a3f0ac766434828f92f39378","user":{"login":"michaelwoerister","id":1825894,"node_id":"MDQ6VXNlcjE4MjU4OTQ=","avatar_url":"https://avatars2.githubusercontent.com/u/1825894?v=4","gravatar_id":"","url":"https://api.github.com/users/michaelwoerister","html_url":"https://github.com/michaelwoerister","followers_url":"https://api.github.com/users/michaelwoerister/followers","following_url":"https://api.github.com/users/michaelwoerister/following{/other_user}","gists_url":"https://api.github.com/users/michaelwoerister/gists{/gist_id}","starred_url":"https://api.github.com/users/michaelwoerister/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaelwoerister/subscriptions","organizations_url":"https://api.github.com/users/michaelwoerister/orgs","repos_url":"https://api.github.com/users/michaelwoerister/repos","events_url":"https://api.github.com/users/michaelwoerister/events{/privacy}","received_events_url":"https://api.github.com/users/michaelwoerister/received_events","type":"User","site_admin":false},"body":"If you use `Global.alloc_zeroed()` above, you don't have to clear things manually here. It might also be faster.","created_at":"2018-07-05T16:10:22Z","updated_at":"2018-07-05T16:29:53Z","html_url":"https://github.com/rust-lang/rust/pull/50959#discussion_r200409368","pull_request_url":"https://api.github.com/repos/rust-lang/rust/pulls/50959","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/comments/200409368"},"html":{"href":"https://github.com/rust-lang/rust/pull/50959#discussion_r200409368"},"pull_request":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/50959"}}},"pull_request":{"url":"https://api.github.com/repos/rust-lang/rust/pulls/50959","id":189547368,"node_id":"MDExOlB1bGxSZXF1ZXN0MTg5NTQ3MzY4","html_url":"https://github.com/rust-lang/rust/pull/50959","diff_url":"https://github.com/rust-lang/rust/pull/50959.diff","patch_url":"https://github.com/rust-lang/rust/pull/50959.patch","issue_url":"https://api.github.com/repos/rust-lang/rust/issues/50959","number":50959,"state":"open","locked":false,"title":"[WIP] Use a custom hash set for interning","user":{"login":"Zoxc","id":25784,"node_id":"MDQ6VXNlcjI1Nzg0","avatar_url":"https://avatars3.githubusercontent.com/u/25784?v=4","gravatar_id":"","url":"https://api.github.com/users/Zoxc","html_url":"https://github.com/Zoxc","followers_url":"https://api.github.com/users/Zoxc/followers","following_url":"https://api.github.com/users/Zoxc/following{/other_user}","gists_url":"https://api.github.com/users/Zoxc/gists{/gist_id}","starred_url":"https://api.github.com/users/Zoxc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Zoxc/subscriptions","organizations_url":"https://api.github.com/users/Zoxc/orgs","repos_url":"https://api.github.com/users/Zoxc/repos","events_url":"https://api.github.com/users/Zoxc/events{/privacy}","received_events_url":"https://api.github.com/users/Zoxc/received_events","type":"User","site_admin":false},"body":"r? @michaelwoerister","created_at":"2018-05-22T04:52:56Z","updated_at":"2018-07-05T16:29:53Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f4e9641ca5e375a9cfe3836295c1745160c82991","assignee":{"login":"michaelwoerister","id":1825894,"node_id":"MDQ6VXNlcjE4MjU4OTQ=","avatar_url":"https://avatars2.githubusercontent.com/u/1825894?v=4","gravatar_id":"","url":"https://api.github.com/users/michaelwoerister","html_url":"https://github.com/michaelwoerister","followers_url":"https://api.github.com/users/michaelwoerister/followers","following_url":"https://api.github.com/users/michaelwoerister/following{/other_user}","gists_url":"https://api.github.com/users/michaelwoerister/gists{/gist_id}","starred_url":"https://api.github.com/users/michaelwoerister/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaelwoerister/subscriptions","organizations_url":"https://api.github.com/users/michaelwoerister/orgs","repos_url":"https://api.github.com/users/michaelwoerister/repos","events_url":"https://api.github.com/users/michaelwoerister/events{/privacy}","received_events_url":"https://api.github.com/users/michaelwoerister/received_events","type":"User","site_admin":false},"assignees":[{"login":"michaelwoerister","id":1825894,"node_id":"MDQ6VXNlcjE4MjU4OTQ=","avatar_url":"https://avatars2.githubusercontent.com/u/1825894?v=4","gravatar_id":"","url":"https://api.github.com/users/michaelwoerister","html_url":"https://github.com/michaelwoerister","followers_url":"https://api.github.com/users/michaelwoerister/followers","following_url":"https://api.github.com/users/michaelwoerister/following{/other_user}","gists_url":"https://api.github.com/users/michaelwoerister/gists{/gist_id}","starred_url":"https://api.github.com/users/michaelwoerister/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaelwoerister/subscriptions","organizations_url":"https://api.github.com/users/michaelwoerister/orgs","repos_url":"https://api.github.com/users/michaelwoerister/repos","events_url":"https://api.github.com/users/michaelwoerister/events{/privacy}","received_events_url":"https://api.github.com/users/michaelwoerister/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":583426710,"node_id":"MDU6TGFiZWw1ODM0MjY3MTA=","url":"https://api.github.com/repos/rust-lang/rust/labels/S-waiting-on-review","name":"S-waiting-on-review","color":"d3dddd","default":false},{"id":211668100,"node_id":"MDU6TGFiZWwyMTE2NjgxMDA=","url":"https://api.github.com/repos/rust-lang/rust/labels/T-compiler","name":"T-compiler","color":"bfd4f2","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/rust-lang/rust/pulls/50959/commits","review_comments_url":"https://api.github.com/repos/rust-lang/rust/pulls/50959/comments","review_comment_url":"https://api.github.com/repos/rust-lang/rust/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/50959/comments","statuses_url":"https://api.github.com/repos/rust-lang/rust/statuses/c124143736c669f0a3f0ac766434828f92f39378","head":{"label":"Zoxc:int-map","ref":"int-map","sha":"c124143736c669f0a3f0ac766434828f92f39378","user":{"login":"Zoxc","id":25784,"node_id":"MDQ6VXNlcjI1Nzg0","avatar_url":"https://avatars3.githubusercontent.com/u/25784?v=4","gravatar_id":"","url":"https://api.github.com/users/Zoxc","html_url":"https://github.com/Zoxc","followers_url":"https://api.github.com/users/Zoxc/followers","following_url":"https://api.github.com/users/Zoxc/following{/other_user}","gists_url":"https://api.github.com/users/Zoxc/gists{/gist_id}","starred_url":"https://api.github.com/users/Zoxc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Zoxc/subscriptions","organizations_url":"https://api.github.com/users/Zoxc/orgs","repos_url":"https://api.github.com/users/Zoxc/repos","events_url":"https://api.github.com/users/Zoxc/events{/privacy}","received_events_url":"https://api.github.com/users/Zoxc/received_events","type":"User","site_admin":false},"repo":{"id":21868454,"node_id":"MDEwOlJlcG9zaXRvcnkyMTg2ODQ1NA==","name":"rust","full_name":"Zoxc/rust","owner":{"login":"Zoxc","id":25784,"node_id":"MDQ6VXNlcjI1Nzg0","avatar_url":"https://avatars3.githubusercontent.com/u/25784?v=4","gravatar_id":"","url":"https://api.github.com/users/Zoxc","html_url":"https://github.com/Zoxc","followers_url":"https://api.github.com/users/Zoxc/followers","following_url":"https://api.github.com/users/Zoxc/following{/other_user}","gists_url":"https://api.github.com/users/Zoxc/gists{/gist_id}","starred_url":"https://api.github.com/users/Zoxc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Zoxc/subscriptions","organizations_url":"https://api.github.com/users/Zoxc/orgs","repos_url":"https://api.github.com/users/Zoxc/repos","events_url":"https://api.github.com/users/Zoxc/events{/privacy}","received_events_url":"https://api.github.com/users/Zoxc/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Zoxc/rust","description":"a safe, concurrent, practical language","fork":true,"url":"https://api.github.com/repos/Zoxc/rust","forks_url":"https://api.github.com/repos/Zoxc/rust/forks","keys_url":"https://api.github.com/repos/Zoxc/rust/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Zoxc/rust/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Zoxc/rust/teams","hooks_url":"https://api.github.com/repos/Zoxc/rust/hooks","issue_events_url":"https://api.github.com/repos/Zoxc/rust/issues/events{/number}","events_url":"https://api.github.com/repos/Zoxc/rust/events","assignees_url":"https://api.github.com/repos/Zoxc/rust/assignees{/user}","branches_url":"https://api.github.com/repos/Zoxc/rust/branches{/branch}","tags_url":"https://api.github.com/repos/Zoxc/rust/tags","blobs_url":"https://api.github.com/repos/Zoxc/rust/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Zoxc/rust/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Zoxc/rust/git/refs{/sha}","trees_url":"https://api.github.com/repos/Zoxc/rust/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Zoxc/rust/statuses/{sha}","languages_url":"https://api.github.com/repos/Zoxc/rust/languages","stargazers_url":"https://api.github.com/repos/Zoxc/rust/stargazers","contributors_url":"https://api.github.com/repos/Zoxc/rust/contributors","subscribers_url":"https://api.github.com/repos/Zoxc/rust/subscribers","subscription_url":"https://api.github.com/repos/Zoxc/rust/subscription","commits_url":"https://api.github.com/repos/Zoxc/rust/commits{/sha}","git_commits_url":"https://api.github.com/repos/Zoxc/rust/git/commits{/sha}","comments_url":"https://api.github.com/repos/Zoxc/rust/comments{/number}","issue_comment_url":"https://api.github.com/repos/Zoxc/rust/issues/comments{/number}","contents_url":"https://api.github.com/repos/Zoxc/rust/contents/{+path}","compare_url":"https://api.github.com/repos/Zoxc/rust/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Zoxc/rust/merges","archive_url":"https://api.github.com/repos/Zoxc/rust/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Zoxc/rust/downloads","issues_url":"https://api.github.com/repos/Zoxc/rust/issues{/number}","pulls_url":"https://api.github.com/repos/Zoxc/rust/pulls{/number}","milestones_url":"https://api.github.com/repos/Zoxc/rust/milestones{/number}","notifications_url":"https://api.github.com/repos/Zoxc/rust/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Zoxc/rust/labels{/name}","releases_url":"https://api.github.com/repos/Zoxc/rust/releases{/id}","deployments_url":"https://api.github.com/repos/Zoxc/rust/deployments","created_at":"2014-07-15T17:08:44Z","updated_at":"2018-03-16T16:02:33Z","pushed_at":"2018-06-29T10:28:19Z","git_url":"git://github.com/Zoxc/rust.git","ssh_url":"git@github.com:Zoxc/rust.git","clone_url":"https://github.com/Zoxc/rust.git","svn_url":"https://github.com/Zoxc/rust","homepage":"http://www.rust-lang.org","size":372274,"stargazers_count":1,"watchers_count":1,"language":"Rust","has_issues":true,"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":1,"default_branch":"master"}},"base":{"label":"rust-lang:master","ref":"master","sha":"7d576f25fcb0b0ea1e4d442329a4949765fa02f0","user":{"login":"rust-lang","id":5430905,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU0MzA5MDU=","avatar_url":"https://avatars1.githubusercontent.com/u/5430905?v=4","gravatar_id":"","url":"https://api.github.com/users/rust-lang","html_url":"https://github.com/rust-lang","followers_url":"https://api.github.com/users/rust-lang/followers","following_url":"https://api.github.com/users/rust-lang/following{/other_user}","gists_url":"https://api.github.com/users/rust-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/rust-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rust-lang/subscriptions","organizations_url":"https://api.github.com/users/rust-lang/orgs","repos_url":"https://api.github.com/users/rust-lang/repos","events_url":"https://api.github.com/users/rust-lang/events{/privacy}","received_events_url":"https://api.github.com/users/rust-lang/received_events","type":"Organization","site_admin":false},"repo":{"id":724712,"node_id":"MDEwOlJlcG9zaXRvcnk3MjQ3MTI=","name":"rust","full_name":"rust-lang/rust","owner":{"login":"rust-lang","id":5430905,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU0MzA5MDU=","avatar_url":"https://avatars1.githubusercontent.com/u/5430905?v=4","gravatar_id":"","url":"https://api.github.com/users/rust-lang","html_url":"https://github.com/rust-lang","followers_url":"https://api.github.com/users/rust-lang/followers","following_url":"https://api.github.com/users/rust-lang/following{/other_user}","gists_url":"https://api.github.com/users/rust-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/rust-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rust-lang/subscriptions","organizations_url":"https://api.github.com/users/rust-lang/orgs","repos_url":"https://api.github.com/users/rust-lang/repos","events_url":"https://api.github.com/users/rust-lang/events{/privacy}","received_events_url":"https://api.github.com/users/rust-lang/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rust-lang/rust","description":"A safe, concurrent, practical language.","fork":false,"url":"https://api.github.com/repos/rust-lang/rust","forks_url":"https://api.github.com/repos/rust-lang/rust/forks","keys_url":"https://api.github.com/repos/rust-lang/rust/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rust-lang/rust/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rust-lang/rust/teams","hooks_url":"https://api.github.com/repos/rust-lang/rust/hooks","issue_events_url":"https://api.github.com/repos/rust-lang/rust/issues/events{/number}","events_url":"https://api.github.com/repos/rust-lang/rust/events","assignees_url":"https://api.github.com/repos/rust-lang/rust/assignees{/user}","branches_url":"https://api.github.com/repos/rust-lang/rust/branches{/branch}","tags_url":"https://api.github.com/repos/rust-lang/rust/tags","blobs_url":"https://api.github.com/repos/rust-lang/rust/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rust-lang/rust/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rust-lang/rust/git/refs{/sha}","trees_url":"https://api.github.com/repos/rust-lang/rust/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rust-lang/rust/statuses/{sha}","languages_url":"https://api.github.com/repos/rust-lang/rust/languages","stargazers_url":"https://api.github.com/repos/rust-lang/rust/stargazers","contributors_url":"https://api.github.com/repos/rust-lang/rust/contributors","subscribers_url":"https://api.github.com/repos/rust-lang/rust/subscribers","subscription_url":"https://api.github.com/repos/rust-lang/rust/subscription","commits_url":"https://api.github.com/repos/rust-lang/rust/commits{/sha}","git_commits_url":"https://api.github.com/repos/rust-lang/rust/git/commits{/sha}","comments_url":"https://api.github.com/repos/rust-lang/rust/comments{/number}","issue_comment_url":"https://api.github.com/repos/rust-lang/rust/issues/comments{/number}","contents_url":"https://api.github.com/repos/rust-lang/rust/contents/{+path}","compare_url":"https://api.github.com/repos/rust-lang/rust/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rust-lang/rust/merges","archive_url":"https://api.github.com/repos/rust-lang/rust/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rust-lang/rust/downloads","issues_url":"https://api.github.com/repos/rust-lang/rust/issues{/number}","pulls_url":"https://api.github.com/repos/rust-lang/rust/pulls{/number}","milestones_url":"https://api.github.com/repos/rust-lang/rust/milestones{/number}","notifications_url":"https://api.github.com/repos/rust-lang/rust/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rust-lang/rust/labels{/name}","releases_url":"https://api.github.com/repos/rust-lang/rust/releases{/id}","deployments_url":"https://api.github.com/repos/rust-lang/rust/deployments","created_at":"2010-06-16T20:39:03Z","updated_at":"2018-07-05T13:49:55Z","pushed_at":"2018-07-05T16:25:27Z","git_url":"git://github.com/rust-lang/rust.git","ssh_url":"git@github.com:rust-lang/rust.git","clone_url":"https://github.com/rust-lang/rust.git","svn_url":"https://github.com/rust-lang/rust","homepage":"https://www.rust-lang.org","size":377793,"stargazers_count":29156,"watchers_count":29156,"language":"Rust","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":5037,"mirror_url":null,"archived":false,"open_issues_count":3941,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":5037,"open_issues":3941,"watchers":29156,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/50959"},"html":{"href":"https://github.com/rust-lang/rust/pull/50959"},"issue":{"href":"https://api.github.com/repos/rust-lang/rust/issues/50959"},"comments":{"href":"https://api.github.com/repos/rust-lang/rust/issues/50959/comments"},"review_comments":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/50959/comments"},"review_comment":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/50959/commits"},"statuses":{"href":"https://api.github.com/repos/rust-lang/rust/statuses/c124143736c669f0a3f0ac766434828f92f39378"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"michaelwoerister"}}