{"action":"created","issue":{"url":"https://api.github.com/repos/golang/go/issues/8898","repository_url":"https://api.github.com/repos/golang/go","labels_url":"https://api.github.com/repos/golang/go/issues/8898/labels{/name}","comments_url":"https://api.github.com/repos/golang/go/issues/8898/comments","events_url":"https://api.github.com/repos/golang/go/issues/8898/events","html_url":"https://github.com/golang/go/issues/8898","id":51288843,"number":8898,"title":"runtime: special case timer channels","user":{"login":"dvyukov","id":1095328,"avatar_url":"https://avatars.githubusercontent.com/u/1095328?v=3","gravatar_id":"","url":"https://api.github.com/users/dvyukov","html_url":"https://github.com/dvyukov","followers_url":"https://api.github.com/users/dvyukov/followers","following_url":"https://api.github.com/users/dvyukov/following{/other_user}","gists_url":"https://api.github.com/users/dvyukov/gists{/gist_id}","starred_url":"https://api.github.com/users/dvyukov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dvyukov/subscriptions","organizations_url":"https://api.github.com/users/dvyukov/orgs","repos_url":"https://api.github.com/users/dvyukov/repos","events_url":"https://api.github.com/users/dvyukov/events{/privacy}","received_events_url":"https://api.github.com/users/dvyukov/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/golang/go/labels/NeedsFix","name":"NeedsFix","color":"ededed"},{"url":"https://api.github.com/repos/golang/go/labels/Performance","name":"Performance","color":"ededed"}],"state":"open","locked":false,"assignee":{"login":"rsc","id":104030,"avatar_url":"https://avatars.githubusercontent.com/u/104030?v=3","gravatar_id":"","url":"https://api.github.com/users/rsc","html_url":"https://github.com/rsc","followers_url":"https://api.github.com/users/rsc/followers","following_url":"https://api.github.com/users/rsc/following{/other_user}","gists_url":"https://api.github.com/users/rsc/gists{/gist_id}","starred_url":"https://api.github.com/users/rsc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rsc/subscriptions","organizations_url":"https://api.github.com/users/rsc/orgs","repos_url":"https://api.github.com/users/rsc/repos","events_url":"https://api.github.com/users/rsc/events{/privacy}","received_events_url":"https://api.github.com/users/rsc/received_events","type":"User","site_admin":false},"assignees":[{"login":"rsc","id":104030,"avatar_url":"https://avatars.githubusercontent.com/u/104030?v=3","gravatar_id":"","url":"https://api.github.com/users/rsc","html_url":"https://github.com/rsc","followers_url":"https://api.github.com/users/rsc/followers","following_url":"https://api.github.com/users/rsc/following{/other_user}","gists_url":"https://api.github.com/users/rsc/gists{/gist_id}","starred_url":"https://api.github.com/users/rsc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rsc/subscriptions","organizations_url":"https://api.github.com/users/rsc/orgs","repos_url":"https://api.github.com/users/rsc/repos","events_url":"https://api.github.com/users/rsc/events{/privacy}","received_events_url":"https://api.github.com/users/rsc/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/golang/go/milestones/39","html_url":"https://github.com/golang/go/milestones/Go1.8Early","labels_url":"https://api.github.com/repos/golang/go/milestones/39/labels","id":1709364,"number":39,"title":"Go1.8Early","description":"","creator":{"login":"griesemer","id":8528975,"avatar_url":"https://avatars.githubusercontent.com/u/8528975?v=3","gravatar_id":"","url":"https://api.github.com/users/griesemer","html_url":"https://github.com/griesemer","followers_url":"https://api.github.com/users/griesemer/followers","following_url":"https://api.github.com/users/griesemer/following{/other_user}","gists_url":"https://api.github.com/users/griesemer/gists{/gist_id}","starred_url":"https://api.github.com/users/griesemer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/griesemer/subscriptions","organizations_url":"https://api.github.com/users/griesemer/orgs","repos_url":"https://api.github.com/users/griesemer/repos","events_url":"https://api.github.com/users/griesemer/events{/privacy}","received_events_url":"https://api.github.com/users/griesemer/received_events","type":"User","site_admin":false},"open_issues":32,"closed_issues":20,"state":"open","created_at":"2016-04-15T16:30:52Z","updated_at":"2016-09-29T20:12:48Z","due_on":"2017-01-31T05:00:00Z","closed_at":null},"comments":4,"created_at":"2014-10-07T13:45:50Z","updated_at":"2016-09-30T21:00:40Z","closed_at":null,"body":"<pre>Consider special-casing timer channels created with time.Ticker and time.After.\nNamely, such chans need to contain next fire time and period. Then receive from such\nlooks like:\n\nfunc chanrecv(c *Hchan) {\n  ...\n  if c.isTimeChan {\n    for {\n      next := c.nextTime\n      if next == -1 {\n        // already fired one-time timer\n        blockForever()\n      }\n      newTime := -1\n      if c.period != 0 {\n        newTime = next + c.period\n      }\n      if CAS(&amp;c.nextTime, next, newTime) {\n        wait := next - now\n        if wait &gt; 0 {\n          sleepFor(wait)\n        }\n        return\n      }\n    }\n  }\n  ...\n}\n\nThis has several advantages:\n1. No need to stop timers. If nobody waits on a timers, it's just a normal heap object\nthat can be garbage collected.\n2. Faster operation for both blocking and non-blocking case.\n3. Faster selects involving time chans.\n4. Can combine time.Ticker/After into a single allocation.</pre>"},"comment":{"url":"https://api.github.com/repos/golang/go/issues/comments/250851116","html_url":"https://github.com/golang/go/issues/8898#issuecomment-250851116","issue_url":"https://api.github.com/repos/golang/go/issues/8898","id":250851116,"user":{"login":"quentinmit","id":115761,"avatar_url":"https://avatars.githubusercontent.com/u/115761?v=3","gravatar_id":"","url":"https://api.github.com/users/quentinmit","html_url":"https://github.com/quentinmit","followers_url":"https://api.github.com/users/quentinmit/followers","following_url":"https://api.github.com/users/quentinmit/following{/other_user}","gists_url":"https://api.github.com/users/quentinmit/gists{/gist_id}","starred_url":"https://api.github.com/users/quentinmit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/quentinmit/subscriptions","organizations_url":"https://api.github.com/users/quentinmit/orgs","repos_url":"https://api.github.com/users/quentinmit/repos","events_url":"https://api.github.com/users/quentinmit/events{/privacy}","received_events_url":"https://api.github.com/users/quentinmit/received_events","type":"User","site_admin":false},"created_at":"2016-09-30T21:00:40Z","updated_at":"2016-09-30T21:00:40Z","body":"@rsc is this going to make 1.8?"}}
{"actor":{"display_login":"quentinmit"}}