{"action":"created","comment":{"url":"https://api.github.com/repos/crystal-lang/crystal/pulls/comments/243910178","pull_request_review_id":187793071,"id":243910178,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI0MzkxMDE3OA==","diff_hunk":"@@ -0,0 +1,41 @@\n+# :nodoc:\n+#\n+# A linked-list of pending fibers. Assumes that a fiber can only be in a\n+# single wait queue at a time, during which its execution is suspended.\n+#\n+# The linked-list is fiber and thread unsafe. Accesses must be synchronized\n+# using another mean, usually `Crystal::SpinLock`.\n+struct Crystal::WaitQueue","path":"src/crystal/wait_queue.cr","position":8,"original_position":8,"commit_id":"0924abab11cf85a85132bdeb3f646db4d7bb3007","original_commit_id":"0924abab11cf85a85132bdeb3f646db4d7bb3007","user":{"login":"yxhuvud","id":155895,"node_id":"MDQ6VXNlcjE1NTg5NQ==","avatar_url":"https://avatars1.githubusercontent.com/u/155895?v=4","gravatar_id":"","url":"https://api.github.com/users/yxhuvud","html_url":"https://github.com/yxhuvud","followers_url":"https://api.github.com/users/yxhuvud/followers","following_url":"https://api.github.com/users/yxhuvud/following{/other_user}","gists_url":"https://api.github.com/users/yxhuvud/gists{/gist_id}","starred_url":"https://api.github.com/users/yxhuvud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yxhuvud/subscriptions","organizations_url":"https://api.github.com/users/yxhuvud/orgs","repos_url":"https://api.github.com/users/yxhuvud/repos","events_url":"https://api.github.com/users/yxhuvud/events{/privacy}","received_events_url":"https://api.github.com/users/yxhuvud/received_events","type":"User","site_admin":false},"body":"Hmm. Considering it is not supposed to be threadsafe and the operations are `push`, `shift`, `each` and `clear`,  is there any reason not to use a `Deque` instead? Or are there some operations (like `delete`) that is hidden somewhere else?","created_at":"2018-12-25T13:44:04Z","updated_at":"2018-12-25T13:53:28Z","html_url":"https://github.com/crystal-lang/crystal/pull/7214#discussion_r243910178","pull_request_url":"https://api.github.com/repos/crystal-lang/crystal/pulls/7214","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/crystal-lang/crystal/pulls/comments/243910178"},"html":{"href":"https://github.com/crystal-lang/crystal/pull/7214#discussion_r243910178"},"pull_request":{"href":"https://api.github.com/repos/crystal-lang/crystal/pulls/7214"}}},"pull_request":{"url":"https://api.github.com/repos/crystal-lang/crystal/pulls/7214","id":240757128,"node_id":"MDExOlB1bGxSZXF1ZXN0MjQwNzU3MTI4","html_url":"https://github.com/crystal-lang/crystal/pull/7214","diff_url":"https://github.com/crystal-lang/crystal/pull/7214.diff","patch_url":"https://github.com/crystal-lang/crystal/pull/7214.patch","issue_url":"https://api.github.com/repos/crystal-lang/crystal/issues/7214","number":7214,"state":"open","locked":false,"title":"MT schedulers","user":{"login":"ysbaddaden","id":47380,"node_id":"MDQ6VXNlcjQ3Mzgw","avatar_url":"https://avatars3.githubusercontent.com/u/47380?v=4","gravatar_id":"","url":"https://api.github.com/users/ysbaddaden","html_url":"https://github.com/ysbaddaden","followers_url":"https://api.github.com/users/ysbaddaden/followers","following_url":"https://api.github.com/users/ysbaddaden/following{/other_user}","gists_url":"https://api.github.com/users/ysbaddaden/gists{/gist_id}","starred_url":"https://api.github.com/users/ysbaddaden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ysbaddaden/subscriptions","organizations_url":"https://api.github.com/users/ysbaddaden/orgs","repos_url":"https://api.github.com/users/ysbaddaden/repos","events_url":"https://api.github.com/users/ysbaddaden/events{/privacy}","received_events_url":"https://api.github.com/users/ysbaddaden/received_events","type":"User","site_admin":false},"body":"Revival of https://github.com/crystal-lang/crystal/pull/6990 with a MT scheduler with blazing fast performance... without a GC.\r\n\r\nPlease see individual commits for some details, and the heavily documented code.\r\n\r\nPlease see the following benchmarks for some awesomeness glimpse into the future, with 1, 4 and 8 threads:\r\n```\r\nswitch[1/128]: crystal: 10000000 yields in 288 ms, 34631387 yields per second\r\nswitch[4/128]: crystal: 10000000 yields in 128 ms, 77606737 yields per second\r\nswitch[8/128]: crystal: 10000000 yields in 91 ms, 108759411 yields per second\r\n```\r\n\r\nYes, over 100 million fiber context switches on a 4 core haswell laptop CPU (without a GC).\r\n\r\nMerry :christmas_tree: :santa: \r\n\r\nWARNINGS:\r\n- work-in-progress (pre-alpha, unsafe, ...) !\r\n- *disables* `select` !\r\n- awfully *slow* performance with BDWGC !\r\n- thread synchronization introduces overhead (~3× slower mutex/channel) !\r\n\r\nTODO:\r\n- [ ] keep the current scheduler/mutex/channel implementations, and hide MT behind a `-Dmt` flag;\r\n- [ ] thread safe pending reader/writer fibers in `IO::Syscall` (e.g. use wait queues?);\r\n- [ ] park scheduler threads when there is nothing to do; wakeup 'em up when fibers are enqueued; make sure to keep one thread alive, for example running the event loop in a blocking manner;\r\n- [ ] the spec suite hangs forever on CI.\r\n\r\nTO SOLVE:\r\n- [ ] fix 32-bit support of scheduler runnables (currently fixed to a 64-bit word, which means a Double-Word CAS on 32-bit);\r\n- [ ] find a solution to re-enable `select` which will be hard because one Fiber can't be queued multiple times —it could end up being resumed on different threads in parallel (oops);\r\n- [ ] find a solution for BDWGC & threads & context switch —and/or make my Immix GC thread-safe.","created_at":"2018-12-24T10:52:38Z","updated_at":"2018-12-25T13:53:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"83048319d4fd7fca9f2b73db9ba0ac55c67286a9","assignee":{"login":"ysbaddaden","id":47380,"node_id":"MDQ6VXNlcjQ3Mzgw","avatar_url":"https://avatars3.githubusercontent.com/u/47380?v=4","gravatar_id":"","url":"https://api.github.com/users/ysbaddaden","html_url":"https://github.com/ysbaddaden","followers_url":"https://api.github.com/users/ysbaddaden/followers","following_url":"https://api.github.com/users/ysbaddaden/following{/other_user}","gists_url":"https://api.github.com/users/ysbaddaden/gists{/gist_id}","starred_url":"https://api.github.com/users/ysbaddaden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ysbaddaden/subscriptions","organizations_url":"https://api.github.com/users/ysbaddaden/orgs","repos_url":"https://api.github.com/users/ysbaddaden/repos","events_url":"https://api.github.com/users/ysbaddaden/events{/privacy}","received_events_url":"https://api.github.com/users/ysbaddaden/received_events","type":"User","site_admin":false},"assignees":[{"login":"ysbaddaden","id":47380,"node_id":"MDQ6VXNlcjQ3Mzgw","avatar_url":"https://avatars3.githubusercontent.com/u/47380?v=4","gravatar_id":"","url":"https://api.github.com/users/ysbaddaden","html_url":"https://github.com/ysbaddaden","followers_url":"https://api.github.com/users/ysbaddaden/followers","following_url":"https://api.github.com/users/ysbaddaden/following{/other_user}","gists_url":"https://api.github.com/users/ysbaddaden/gists{/gist_id}","starred_url":"https://api.github.com/users/ysbaddaden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ysbaddaden/subscriptions","organizations_url":"https://api.github.com/users/ysbaddaden/orgs","repos_url":"https://api.github.com/users/ysbaddaden/repos","events_url":"https://api.github.com/users/ysbaddaden/events{/privacy}","received_events_url":"https://api.github.com/users/ysbaddaden/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":514698748,"node_id":"MDU6TGFiZWw1MTQ2OTg3NDg=","url":"https://api.github.com/repos/crystal-lang/crystal/labels/pr:wip","name":"pr:wip","color":"d4c5f9","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/crystal-lang/crystal/pulls/7214/commits","review_comments_url":"https://api.github.com/repos/crystal-lang/crystal/pulls/7214/comments","review_comment_url":"https://api.github.com/repos/crystal-lang/crystal/pulls/comments{/number}","comments_url":"https://api.github.com/repos/crystal-lang/crystal/issues/7214/comments","statuses_url":"https://api.github.com/repos/crystal-lang/crystal/statuses/0924abab11cf85a85132bdeb3f646db4d7bb3007","head":{"label":"ysbaddaden:core-extract-fiber-context","ref":"core-extract-fiber-context","sha":"0924abab11cf85a85132bdeb3f646db4d7bb3007","user":{"login":"ysbaddaden","id":47380,"node_id":"MDQ6VXNlcjQ3Mzgw","avatar_url":"https://avatars3.githubusercontent.com/u/47380?v=4","gravatar_id":"","url":"https://api.github.com/users/ysbaddaden","html_url":"https://github.com/ysbaddaden","followers_url":"https://api.github.com/users/ysbaddaden/followers","following_url":"https://api.github.com/users/ysbaddaden/following{/other_user}","gists_url":"https://api.github.com/users/ysbaddaden/gists{/gist_id}","starred_url":"https://api.github.com/users/ysbaddaden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ysbaddaden/subscriptions","organizations_url":"https://api.github.com/users/ysbaddaden/orgs","repos_url":"https://api.github.com/users/ysbaddaden/repos","events_url":"https://api.github.com/users/ysbaddaden/events{/privacy}","received_events_url":"https://api.github.com/users/ysbaddaden/received_events","type":"User","site_admin":false},"repo":{"id":28955723,"node_id":"MDEwOlJlcG9zaXRvcnkyODk1NTcyMw==","name":"crystal","full_name":"ysbaddaden/crystal","private":false,"owner":{"login":"ysbaddaden","id":47380,"node_id":"MDQ6VXNlcjQ3Mzgw","avatar_url":"https://avatars3.githubusercontent.com/u/47380?v=4","gravatar_id":"","url":"https://api.github.com/users/ysbaddaden","html_url":"https://github.com/ysbaddaden","followers_url":"https://api.github.com/users/ysbaddaden/followers","following_url":"https://api.github.com/users/ysbaddaden/following{/other_user}","gists_url":"https://api.github.com/users/ysbaddaden/gists{/gist_id}","starred_url":"https://api.github.com/users/ysbaddaden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ysbaddaden/subscriptions","organizations_url":"https://api.github.com/users/ysbaddaden/orgs","repos_url":"https://api.github.com/users/ysbaddaden/repos","events_url":"https://api.github.com/users/ysbaddaden/events{/privacy}","received_events_url":"https://api.github.com/users/ysbaddaden/received_events","type":"User","site_admin":false},"html_url":"https://github.com/ysbaddaden/crystal","description":"The Crystal Programming Language","fork":true,"url":"https://api.github.com/repos/ysbaddaden/crystal","forks_url":"https://api.github.com/repos/ysbaddaden/crystal/forks","keys_url":"https://api.github.com/repos/ysbaddaden/crystal/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ysbaddaden/crystal/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ysbaddaden/crystal/teams","hooks_url":"https://api.github.com/repos/ysbaddaden/crystal/hooks","issue_events_url":"https://api.github.com/repos/ysbaddaden/crystal/issues/events{/number}","events_url":"https://api.github.com/repos/ysbaddaden/crystal/events","assignees_url":"https://api.github.com/repos/ysbaddaden/crystal/assignees{/user}","branches_url":"https://api.github.com/repos/ysbaddaden/crystal/branches{/branch}","tags_url":"https://api.github.com/repos/ysbaddaden/crystal/tags","blobs_url":"https://api.github.com/repos/ysbaddaden/crystal/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ysbaddaden/crystal/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ysbaddaden/crystal/git/refs{/sha}","trees_url":"https://api.github.com/repos/ysbaddaden/crystal/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ysbaddaden/crystal/statuses/{sha}","languages_url":"https://api.github.com/repos/ysbaddaden/crystal/languages","stargazers_url":"https://api.github.com/repos/ysbaddaden/crystal/stargazers","contributors_url":"https://api.github.com/repos/ysbaddaden/crystal/contributors","subscribers_url":"https://api.github.com/repos/ysbaddaden/crystal/subscribers","subscription_url":"https://api.github.com/repos/ysbaddaden/crystal/subscription","commits_url":"https://api.github.com/repos/ysbaddaden/crystal/commits{/sha}","git_commits_url":"https://api.github.com/repos/ysbaddaden/crystal/git/commits{/sha}","comments_url":"https://api.github.com/repos/ysbaddaden/crystal/comments{/number}","issue_comment_url":"https://api.github.com/repos/ysbaddaden/crystal/issues/comments{/number}","contents_url":"https://api.github.com/repos/ysbaddaden/crystal/contents/{+path}","compare_url":"https://api.github.com/repos/ysbaddaden/crystal/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ysbaddaden/crystal/merges","archive_url":"https://api.github.com/repos/ysbaddaden/crystal/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ysbaddaden/crystal/downloads","issues_url":"https://api.github.com/repos/ysbaddaden/crystal/issues{/number}","pulls_url":"https://api.github.com/repos/ysbaddaden/crystal/pulls{/number}","milestones_url":"https://api.github.com/repos/ysbaddaden/crystal/milestones{/number}","notifications_url":"https://api.github.com/repos/ysbaddaden/crystal/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ysbaddaden/crystal/labels{/name}","releases_url":"https://api.github.com/repos/ysbaddaden/crystal/releases{/id}","deployments_url":"https://api.github.com/repos/ysbaddaden/crystal/deployments","created_at":"2015-01-08T08:08:48Z","updated_at":"2018-06-04T19:36:14Z","pushed_at":"2018-12-25T00:26:22Z","git_url":"git://github.com/ysbaddaden/crystal.git","ssh_url":"git@github.com:ysbaddaden/crystal.git","clone_url":"https://github.com/ysbaddaden/crystal.git","svn_url":"https://github.com/ysbaddaden/crystal","homepage":"http://crystal-lang.org","size":42441,"stargazers_count":1,"watchers_count":1,"language":"Crystal","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":1,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":1,"watchers":1,"default_branch":"master"}},"base":{"label":"crystal-lang:master","ref":"master","sha":"74c65ce6b8dde60f867468bfd4ce0cfcd11c8331","user":{"login":"crystal-lang","id":6539796,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY1Mzk3OTY=","avatar_url":"https://avatars0.githubusercontent.com/u/6539796?v=4","gravatar_id":"","url":"https://api.github.com/users/crystal-lang","html_url":"https://github.com/crystal-lang","followers_url":"https://api.github.com/users/crystal-lang/followers","following_url":"https://api.github.com/users/crystal-lang/following{/other_user}","gists_url":"https://api.github.com/users/crystal-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/crystal-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crystal-lang/subscriptions","organizations_url":"https://api.github.com/users/crystal-lang/orgs","repos_url":"https://api.github.com/users/crystal-lang/repos","events_url":"https://api.github.com/users/crystal-lang/events{/privacy}","received_events_url":"https://api.github.com/users/crystal-lang/received_events","type":"Organization","site_admin":false},"repo":{"id":6887813,"node_id":"MDEwOlJlcG9zaXRvcnk2ODg3ODEz","name":"crystal","full_name":"crystal-lang/crystal","private":false,"owner":{"login":"crystal-lang","id":6539796,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY1Mzk3OTY=","avatar_url":"https://avatars0.githubusercontent.com/u/6539796?v=4","gravatar_id":"","url":"https://api.github.com/users/crystal-lang","html_url":"https://github.com/crystal-lang","followers_url":"https://api.github.com/users/crystal-lang/followers","following_url":"https://api.github.com/users/crystal-lang/following{/other_user}","gists_url":"https://api.github.com/users/crystal-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/crystal-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crystal-lang/subscriptions","organizations_url":"https://api.github.com/users/crystal-lang/orgs","repos_url":"https://api.github.com/users/crystal-lang/repos","events_url":"https://api.github.com/users/crystal-lang/events{/privacy}","received_events_url":"https://api.github.com/users/crystal-lang/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/crystal-lang/crystal","description":"The Crystal Programming Language","fork":false,"url":"https://api.github.com/repos/crystal-lang/crystal","forks_url":"https://api.github.com/repos/crystal-lang/crystal/forks","keys_url":"https://api.github.com/repos/crystal-lang/crystal/keys{/key_id}","collaborators_url":"https://api.github.com/repos/crystal-lang/crystal/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/crystal-lang/crystal/teams","hooks_url":"https://api.github.com/repos/crystal-lang/crystal/hooks","issue_events_url":"https://api.github.com/repos/crystal-lang/crystal/issues/events{/number}","events_url":"https://api.github.com/repos/crystal-lang/crystal/events","assignees_url":"https://api.github.com/repos/crystal-lang/crystal/assignees{/user}","branches_url":"https://api.github.com/repos/crystal-lang/crystal/branches{/branch}","tags_url":"https://api.github.com/repos/crystal-lang/crystal/tags","blobs_url":"https://api.github.com/repos/crystal-lang/crystal/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/crystal-lang/crystal/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/crystal-lang/crystal/git/refs{/sha}","trees_url":"https://api.github.com/repos/crystal-lang/crystal/git/trees{/sha}","statuses_url":"https://api.github.com/repos/crystal-lang/crystal/statuses/{sha}","languages_url":"https://api.github.com/repos/crystal-lang/crystal/languages","stargazers_url":"https://api.github.com/repos/crystal-lang/crystal/stargazers","contributors_url":"https://api.github.com/repos/crystal-lang/crystal/contributors","subscribers_url":"https://api.github.com/repos/crystal-lang/crystal/subscribers","subscription_url":"https://api.github.com/repos/crystal-lang/crystal/subscription","commits_url":"https://api.github.com/repos/crystal-lang/crystal/commits{/sha}","git_commits_url":"https://api.github.com/repos/crystal-lang/crystal/git/commits{/sha}","comments_url":"https://api.github.com/repos/crystal-lang/crystal/comments{/number}","issue_comment_url":"https://api.github.com/repos/crystal-lang/crystal/issues/comments{/number}","contents_url":"https://api.github.com/repos/crystal-lang/crystal/contents/{+path}","compare_url":"https://api.github.com/repos/crystal-lang/crystal/compare/{base}...{head}","merges_url":"https://api.github.com/repos/crystal-lang/crystal/merges","archive_url":"https://api.github.com/repos/crystal-lang/crystal/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/crystal-lang/crystal/downloads","issues_url":"https://api.github.com/repos/crystal-lang/crystal/issues{/number}","pulls_url":"https://api.github.com/repos/crystal-lang/crystal/pulls{/number}","milestones_url":"https://api.github.com/repos/crystal-lang/crystal/milestones{/number}","notifications_url":"https://api.github.com/repos/crystal-lang/crystal/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/crystal-lang/crystal/labels{/name}","releases_url":"https://api.github.com/repos/crystal-lang/crystal/releases{/id}","deployments_url":"https://api.github.com/repos/crystal-lang/crystal/deployments","created_at":"2012-11-27T17:32:32Z","updated_at":"2018-12-25T13:31:24Z","pushed_at":"2018-12-25T00:26:25Z","git_url":"git://github.com/crystal-lang/crystal.git","ssh_url":"git@github.com:crystal-lang/crystal.git","clone_url":"https://github.com/crystal-lang/crystal.git","svn_url":"https://github.com/crystal-lang/crystal","homepage":"https://crystal-lang.org","size":38027,"stargazers_count":12390,"watchers_count":12390,"language":"Crystal","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":960,"mirror_url":null,"archived":false,"open_issues_count":799,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":960,"open_issues":799,"watchers":12390,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/crystal-lang/crystal/pulls/7214"},"html":{"href":"https://github.com/crystal-lang/crystal/pull/7214"},"issue":{"href":"https://api.github.com/repos/crystal-lang/crystal/issues/7214"},"comments":{"href":"https://api.github.com/repos/crystal-lang/crystal/issues/7214/comments"},"review_comments":{"href":"https://api.github.com/repos/crystal-lang/crystal/pulls/7214/comments"},"review_comment":{"href":"https://api.github.com/repos/crystal-lang/crystal/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/crystal-lang/crystal/pulls/7214/commits"},"statuses":{"href":"https://api.github.com/repos/crystal-lang/crystal/statuses/0924abab11cf85a85132bdeb3f646db4d7bb3007"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"yxhuvud"}}