{"action":"created","comment":{"url":"https://api.github.com/repos/dotnet/orleans/pulls/comments/79536299","id":79536299,"diff_hunk":"@@ -0,0 +1,128 @@\n+﻿using System;\n+using System.Collections.Generic;\n+using System.Linq;\n+using System.Text;\n+using System.Threading;\n+using System.Threading.Tasks;\n+using Orleans.Runtime;\n+\n+namespace Orleans.Runtime\n+{\n+    // Removes the need in timer per item, optimized for singlethreaded consumption. \n+    internal class TimerWheel<T> : IDisposable where T : ITimebound\n+    {\n+        private const int MaxItemsPerLock = 10;\n+        private readonly Queue<T> _entries = new Queue<T>();","path":"src/Orleans/Utils/TimerWheel.cs","position":15,"original_position":15,"commit_id":"2e4a5ffd820ba81d23b0a717a83dc2637d0e1b6e","original_commit_id":"2e4a5ffd820ba81d23b0a717a83dc2637d0e1b6e","user":{"login":"gabikliot","id":10171207,"avatar_url":"https://avatars.githubusercontent.com/u/10171207?v=3","gravatar_id":"","url":"https://api.github.com/users/gabikliot","html_url":"https://github.com/gabikliot","followers_url":"https://api.github.com/users/gabikliot/followers","following_url":"https://api.github.com/users/gabikliot/following{/other_user}","gists_url":"https://api.github.com/users/gabikliot/gists{/gist_id}","starred_url":"https://api.github.com/users/gabikliot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gabikliot/subscriptions","organizations_url":"https://api.github.com/users/gabikliot/orgs","repos_url":"https://api.github.com/users/gabikliot/repos","events_url":"https://api.github.com/users/gabikliot/events{/privacy}","received_events_url":"https://api.github.com/users/gabikliot/received_events","type":"User","site_admin":false},"body":"One negative caveat of your impl. is that in the fast path case, you will be holding  to the element in this queue for full 30 sec, while in old impl. we disposed timer immediately upon succesfull reply. Therefore, you will be holding callback datas for 30 sec, which can increase memory footprint.\r\nThe solution is either to support dispose/unregister, or store weak reference to T.\r\n","created_at":"2016-09-20T04:55:30Z","updated_at":"2016-09-20T05:02:44Z","html_url":"https://github.com/dotnet/orleans/pull/2159#discussion_r79536299","pull_request_url":"https://api.github.com/repos/dotnet/orleans/pulls/2159","_links":{"self":{"href":"https://api.github.com/repos/dotnet/orleans/pulls/comments/79536299"},"html":{"href":"https://github.com/dotnet/orleans/pull/2159#discussion_r79536299"},"pull_request":{"href":"https://api.github.com/repos/dotnet/orleans/pulls/2159"}}},"pull_request":{"url":"https://api.github.com/repos/dotnet/orleans/pulls/2159","id":85474771,"html_url":"https://github.com/dotnet/orleans/pull/2159","diff_url":"https://github.com/dotnet/orleans/pull/2159.diff","patch_url":"https://github.com/dotnet/orleans/pull/2159.patch","issue_url":"https://api.github.com/repos/dotnet/orleans/issues/2159","number":2159,"state":"open","locked":false,"title":"Optimize callbacks timeouts","user":{"login":"dVakulen","id":5787619,"avatar_url":"https://avatars.githubusercontent.com/u/5787619?v=3","gravatar_id":"","url":"https://api.github.com/users/dVakulen","html_url":"https://github.com/dVakulen","followers_url":"https://api.github.com/users/dVakulen/followers","following_url":"https://api.github.com/users/dVakulen/following{/other_user}","gists_url":"https://api.github.com/users/dVakulen/gists{/gist_id}","starred_url":"https://api.github.com/users/dVakulen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dVakulen/subscriptions","organizations_url":"https://api.github.com/users/dVakulen/orgs","repos_url":"https://api.github.com/users/dVakulen/repos","events_url":"https://api.github.com/users/dVakulen/events{/privacy}","received_events_url":"https://api.github.com/users/dVakulen/received_events","type":"User","site_admin":false},"body":"Creating and disposing of timer per two-way message costs 0.5 seconds per 1 million of callbacks. \r\n\r\nLinear increment of due date allows using of the queue for storing callbacks, with single timer for checking it. \r\nIn some cases callback instance may be promoted to next GC gen, which wouldn't had happen otherwise, but it's doesn't matter much.  \r\n\r\nLocal benchmark shows up to 7% throughput increase, but I'm not sure which effect it will have on the real benchmarks.\r\n","created_at":"2016-09-15T20:31:11Z","updated_at":"2016-09-20T05:02:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fd9c5e1fb0409d80ba1f8848f2df21b1708cc9aa","assignee":{"login":"gabikliot","id":10171207,"avatar_url":"https://avatars.githubusercontent.com/u/10171207?v=3","gravatar_id":"","url":"https://api.github.com/users/gabikliot","html_url":"https://github.com/gabikliot","followers_url":"https://api.github.com/users/gabikliot/followers","following_url":"https://api.github.com/users/gabikliot/following{/other_user}","gists_url":"https://api.github.com/users/gabikliot/gists{/gist_id}","starred_url":"https://api.github.com/users/gabikliot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gabikliot/subscriptions","organizations_url":"https://api.github.com/users/gabikliot/orgs","repos_url":"https://api.github.com/users/gabikliot/repos","events_url":"https://api.github.com/users/gabikliot/events{/privacy}","received_events_url":"https://api.github.com/users/gabikliot/received_events","type":"User","site_admin":false},"assignees":[{"login":"gabikliot","id":10171207,"avatar_url":"https://avatars.githubusercontent.com/u/10171207?v=3","gravatar_id":"","url":"https://api.github.com/users/gabikliot","html_url":"https://github.com/gabikliot","followers_url":"https://api.github.com/users/gabikliot/followers","following_url":"https://api.github.com/users/gabikliot/following{/other_user}","gists_url":"https://api.github.com/users/gabikliot/gists{/gist_id}","starred_url":"https://api.github.com/users/gabikliot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gabikliot/subscriptions","organizations_url":"https://api.github.com/users/gabikliot/orgs","repos_url":"https://api.github.com/users/gabikliot/repos","events_url":"https://api.github.com/users/gabikliot/events{/privacy}","received_events_url":"https://api.github.com/users/gabikliot/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/dotnet/orleans/pulls/2159/commits","review_comments_url":"https://api.github.com/repos/dotnet/orleans/pulls/2159/comments","review_comment_url":"https://api.github.com/repos/dotnet/orleans/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dotnet/orleans/issues/2159/comments","statuses_url":"https://api.github.com/repos/dotnet/orleans/statuses/2e4a5ffd820ba81d23b0a717a83dc2637d0e1b6e","head":{"label":"dVakulen:timeout-timer","ref":"timeout-timer","sha":"2e4a5ffd820ba81d23b0a717a83dc2637d0e1b6e","user":{"login":"dVakulen","id":5787619,"avatar_url":"https://avatars.githubusercontent.com/u/5787619?v=3","gravatar_id":"","url":"https://api.github.com/users/dVakulen","html_url":"https://github.com/dVakulen","followers_url":"https://api.github.com/users/dVakulen/followers","following_url":"https://api.github.com/users/dVakulen/following{/other_user}","gists_url":"https://api.github.com/users/dVakulen/gists{/gist_id}","starred_url":"https://api.github.com/users/dVakulen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dVakulen/subscriptions","organizations_url":"https://api.github.com/users/dVakulen/orgs","repos_url":"https://api.github.com/users/dVakulen/repos","events_url":"https://api.github.com/users/dVakulen/events{/privacy}","received_events_url":"https://api.github.com/users/dVakulen/received_events","type":"User","site_admin":false},"repo":{"id":37816139,"name":"orleans","full_name":"dVakulen/orleans","owner":{"login":"dVakulen","id":5787619,"avatar_url":"https://avatars.githubusercontent.com/u/5787619?v=3","gravatar_id":"","url":"https://api.github.com/users/dVakulen","html_url":"https://github.com/dVakulen","followers_url":"https://api.github.com/users/dVakulen/followers","following_url":"https://api.github.com/users/dVakulen/following{/other_user}","gists_url":"https://api.github.com/users/dVakulen/gists{/gist_id}","starred_url":"https://api.github.com/users/dVakulen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dVakulen/subscriptions","organizations_url":"https://api.github.com/users/dVakulen/orgs","repos_url":"https://api.github.com/users/dVakulen/repos","events_url":"https://api.github.com/users/dVakulen/events{/privacy}","received_events_url":"https://api.github.com/users/dVakulen/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dVakulen/orleans","description":"Orleans - Distributed Virtual Actor Model","fork":true,"url":"https://api.github.com/repos/dVakulen/orleans","forks_url":"https://api.github.com/repos/dVakulen/orleans/forks","keys_url":"https://api.github.com/repos/dVakulen/orleans/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dVakulen/orleans/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dVakulen/orleans/teams","hooks_url":"https://api.github.com/repos/dVakulen/orleans/hooks","issue_events_url":"https://api.github.com/repos/dVakulen/orleans/issues/events{/number}","events_url":"https://api.github.com/repos/dVakulen/orleans/events","assignees_url":"https://api.github.com/repos/dVakulen/orleans/assignees{/user}","branches_url":"https://api.github.com/repos/dVakulen/orleans/branches{/branch}","tags_url":"https://api.github.com/repos/dVakulen/orleans/tags","blobs_url":"https://api.github.com/repos/dVakulen/orleans/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dVakulen/orleans/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dVakulen/orleans/git/refs{/sha}","trees_url":"https://api.github.com/repos/dVakulen/orleans/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dVakulen/orleans/statuses/{sha}","languages_url":"https://api.github.com/repos/dVakulen/orleans/languages","stargazers_url":"https://api.github.com/repos/dVakulen/orleans/stargazers","contributors_url":"https://api.github.com/repos/dVakulen/orleans/contributors","subscribers_url":"https://api.github.com/repos/dVakulen/orleans/subscribers","subscription_url":"https://api.github.com/repos/dVakulen/orleans/subscription","commits_url":"https://api.github.com/repos/dVakulen/orleans/commits{/sha}","git_commits_url":"https://api.github.com/repos/dVakulen/orleans/git/commits{/sha}","comments_url":"https://api.github.com/repos/dVakulen/orleans/comments{/number}","issue_comment_url":"https://api.github.com/repos/dVakulen/orleans/issues/comments{/number}","contents_url":"https://api.github.com/repos/dVakulen/orleans/contents/{+path}","compare_url":"https://api.github.com/repos/dVakulen/orleans/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dVakulen/orleans/merges","archive_url":"https://api.github.com/repos/dVakulen/orleans/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dVakulen/orleans/downloads","issues_url":"https://api.github.com/repos/dVakulen/orleans/issues{/number}","pulls_url":"https://api.github.com/repos/dVakulen/orleans/pulls{/number}","milestones_url":"https://api.github.com/repos/dVakulen/orleans/milestones{/number}","notifications_url":"https://api.github.com/repos/dVakulen/orleans/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dVakulen/orleans/labels{/name}","releases_url":"https://api.github.com/repos/dVakulen/orleans/releases{/id}","deployments_url":"https://api.github.com/repos/dVakulen/orleans/deployments","created_at":"2015-06-21T16:29:25Z","updated_at":"2016-01-19T12:31:13Z","pushed_at":"2016-09-17T19:12:18Z","git_url":"git://github.com/dVakulen/orleans.git","ssh_url":"git@github.com:dVakulen/orleans.git","clone_url":"https://github.com/dVakulen/orleans.git","svn_url":"https://github.com/dVakulen/orleans","homepage":"http://dotnet.github.io/orleans","size":16067,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"dotnet:master","ref":"master","sha":"4c21909984d458a92753439e7c973eb0fc5b9112","user":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars.githubusercontent.com/u/9141961?v=3","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"repo":{"id":28232663,"name":"orleans","full_name":"dotnet/orleans","owner":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars.githubusercontent.com/u/9141961?v=3","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dotnet/orleans","description":"Orleans - Distributed Virtual Actor Model","fork":false,"url":"https://api.github.com/repos/dotnet/orleans","forks_url":"https://api.github.com/repos/dotnet/orleans/forks","keys_url":"https://api.github.com/repos/dotnet/orleans/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dotnet/orleans/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dotnet/orleans/teams","hooks_url":"https://api.github.com/repos/dotnet/orleans/hooks","issue_events_url":"https://api.github.com/repos/dotnet/orleans/issues/events{/number}","events_url":"https://api.github.com/repos/dotnet/orleans/events","assignees_url":"https://api.github.com/repos/dotnet/orleans/assignees{/user}","branches_url":"https://api.github.com/repos/dotnet/orleans/branches{/branch}","tags_url":"https://api.github.com/repos/dotnet/orleans/tags","blobs_url":"https://api.github.com/repos/dotnet/orleans/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dotnet/orleans/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dotnet/orleans/git/refs{/sha}","trees_url":"https://api.github.com/repos/dotnet/orleans/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dotnet/orleans/statuses/{sha}","languages_url":"https://api.github.com/repos/dotnet/orleans/languages","stargazers_url":"https://api.github.com/repos/dotnet/orleans/stargazers","contributors_url":"https://api.github.com/repos/dotnet/orleans/contributors","subscribers_url":"https://api.github.com/repos/dotnet/orleans/subscribers","subscription_url":"https://api.github.com/repos/dotnet/orleans/subscription","commits_url":"https://api.github.com/repos/dotnet/orleans/commits{/sha}","git_commits_url":"https://api.github.com/repos/dotnet/orleans/git/commits{/sha}","comments_url":"https://api.github.com/repos/dotnet/orleans/comments{/number}","issue_comment_url":"https://api.github.com/repos/dotnet/orleans/issues/comments{/number}","contents_url":"https://api.github.com/repos/dotnet/orleans/contents/{+path}","compare_url":"https://api.github.com/repos/dotnet/orleans/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dotnet/orleans/merges","archive_url":"https://api.github.com/repos/dotnet/orleans/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dotnet/orleans/downloads","issues_url":"https://api.github.com/repos/dotnet/orleans/issues{/number}","pulls_url":"https://api.github.com/repos/dotnet/orleans/pulls{/number}","milestones_url":"https://api.github.com/repos/dotnet/orleans/milestones{/number}","notifications_url":"https://api.github.com/repos/dotnet/orleans/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dotnet/orleans/labels{/name}","releases_url":"https://api.github.com/repos/dotnet/orleans/releases{/id}","deployments_url":"https://api.github.com/repos/dotnet/orleans/deployments","created_at":"2014-12-19T14:32:50Z","updated_at":"2016-09-19T16:54:34Z","pushed_at":"2016-09-20T02:41:23Z","git_url":"git://github.com/dotnet/orleans.git","ssh_url":"git@github.com:dotnet/orleans.git","clone_url":"https://github.com/dotnet/orleans.git","svn_url":"https://github.com/dotnet/orleans","homepage":"http://dotnet.github.io/orleans","size":50127,"stargazers_count":2231,"watchers_count":2231,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":546,"mirror_url":null,"open_issues_count":275,"forks":546,"open_issues":275,"watchers":2231,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dotnet/orleans/pulls/2159"},"html":{"href":"https://github.com/dotnet/orleans/pull/2159"},"issue":{"href":"https://api.github.com/repos/dotnet/orleans/issues/2159"},"comments":{"href":"https://api.github.com/repos/dotnet/orleans/issues/2159/comments"},"review_comments":{"href":"https://api.github.com/repos/dotnet/orleans/pulls/2159/comments"},"review_comment":{"href":"https://api.github.com/repos/dotnet/orleans/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dotnet/orleans/pulls/2159/commits"},"statuses":{"href":"https://api.github.com/repos/dotnet/orleans/statuses/2e4a5ffd820ba81d23b0a717a83dc2637d0e1b6e"}}}}
{"actor":{"display_login":"gabikliot"}}