{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/9956","repository_url":"https://api.github.com/repos/Microsoft/TypeScript","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/9956/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/9956/comments","events_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/9956/events","html_url":"https://github.com/Microsoft/TypeScript/pull/9956","id":167662846,"number":9956,"title":"In ts.performance.now, bind window.performance.now","user":{"login":"sandersn","id":293473,"avatar_url":"https://avatars.githubusercontent.com/u/293473?v=3","gravatar_id":"","url":"https://api.github.com/users/sandersn","html_url":"https://github.com/sandersn","followers_url":"https://api.github.com/users/sandersn/followers","following_url":"https://api.github.com/users/sandersn/following{/other_user}","gists_url":"https://api.github.com/users/sandersn/gists{/gist_id}","starred_url":"https://api.github.com/users/sandersn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sandersn/subscriptions","organizations_url":"https://api.github.com/users/sandersn/orgs","repos_url":"https://api.github.com/users/sandersn/repos","events_url":"https://api.github.com/users/sandersn/events{/privacy}","received_events_url":"https://api.github.com/users/sandersn/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Microsoft/TypeScript/labels/cla-not-required","name":"cla-not-required","color":"009800"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2016-07-26T17:17:55Z","updated_at":"2016-07-27T14:45:37Z","closed_at":"2016-07-26T18:31:54Z","pull_request":{"url":"https://api.github.com/repos/Microsoft/TypeScript/pulls/9956","html_url":"https://github.com/Microsoft/TypeScript/pull/9956","diff_url":"https://github.com/Microsoft/TypeScript/pull/9956.diff","patch_url":"https://github.com/Microsoft/TypeScript/pull/9956.patch"},"body":"Fixes #9954\r\n\r\nUsing an arrow function. Previously, it was set directly to window.performance.now, which fails when used in Chrome."},"comment":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/comments/235608095","html_url":"https://github.com/Microsoft/TypeScript/pull/9956#issuecomment-235608095","issue_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/9956","id":235608095,"user":{"login":"mihailik","id":4041967,"avatar_url":"https://avatars.githubusercontent.com/u/4041967?v=3","gravatar_id":"","url":"https://api.github.com/users/mihailik","html_url":"https://github.com/mihailik","followers_url":"https://api.github.com/users/mihailik/followers","following_url":"https://api.github.com/users/mihailik/following{/other_user}","gists_url":"https://api.github.com/users/mihailik/gists{/gist_id}","starred_url":"https://api.github.com/users/mihailik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mihailik/subscriptions","organizations_url":"https://api.github.com/users/mihailik/orgs","repos_url":"https://api.github.com/users/mihailik/repos","events_url":"https://api.github.com/users/mihailik/events{/privacy}","received_events_url":"https://api.github.com/users/mihailik/received_events","type":"User","site_admin":false},"created_at":"2016-07-27T14:45:37Z","updated_at":"2016-07-27T14:45:37Z","body":"FYI: compared `() => performance.now()` with `performance.now.bind(performance)`, the **arrow function is faster on my Chrome, faster in FireFox — but slower on IE11.**\r\n\r\nDon't have an Edge to try.\r\n\r\nHere's the code below to run in DevTools console:\r\n\r\n```javascript\r\nvar runAndAgain = function() {\r\n  setTimeout(function() {\r\n    runMillion();\r\n    runAndAgain();\r\n  }, 1);\r\n};\r\nrunAndAgain();\r\n\r\nfunction runMillion() {\r\n\r\n  var now_arrow = function() { return performance.now(); };\r\n  var now_bind = performance.now.bind(performance);\r\n\r\n  var start = new Date(), tmp=0;\r\n  for (var i = 0; i < 1000000; i++) { tmp = now_arrow(); }\r\n  var arrow_time = new Date() - start;\r\n\r\n  var start = new Date(), tmp=0;\r\n  for (var i = 0; i < 1000000; i++) { tmp = now_bind(); }\r\n  var bind_time = new Date() - start;\r\n\r\n  console.log('arrow '+arrow_time+'\\tbind '+bind_time+'\\t ratio '+(((10000*arrow_time/bind_time)|0)/100)+'%');\r\n}\r\n```"}}
{"actor":{"display_login":"mihailik"}}