{"action":"created","issue":{"url":"https://api.github.com/repos/nodejs/node/issues/914","labels_url":"https://api.github.com/repos/nodejs/node/issues/914/labels{/name}","comments_url":"https://api.github.com/repos/nodejs/node/issues/914/comments","events_url":"https://api.github.com/repos/nodejs/node/issues/914/events","html_url":"https://github.com/nodejs/node/pull/914","id":58447946,"number":914,"title":"events: optimize eventEmitter.once()","user":{"login":"mscdex","id":54666,"avatar_url":"https://avatars.githubusercontent.com/u/54666?v=3","gravatar_id":"","url":"https://api.github.com/users/mscdex","html_url":"https://github.com/mscdex","followers_url":"https://api.github.com/users/mscdex/followers","following_url":"https://api.github.com/users/mscdex/following{/other_user}","gists_url":"https://api.github.com/users/mscdex/gists{/gist_id}","starred_url":"https://api.github.com/users/mscdex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mscdex/subscriptions","organizations_url":"https://api.github.com/users/mscdex/orgs","repos_url":"https://api.github.com/users/mscdex/repos","events_url":"https://api.github.com/users/mscdex/events{/privacy}","received_events_url":"https://api.github.com/users/mscdex/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/nodejs/node/labels/events","name":"events","color":"bfdadc"},{"url":"https://api.github.com/repos/nodejs/node/labels/land-on-master","name":"land-on-master","color":"333333"},{"url":"https://api.github.com/repos/nodejs/node/labels/semver-major","name":"semver-major","color":"fbca04"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":14,"created_at":"2015-02-21T07:21:44Z","updated_at":"2015-10-19T16:23:24Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/nodejs/node/pulls/914","html_url":"https://github.com/nodejs/node/pull/914","diff_url":"https://github.com/nodejs/node/pull/914.diff","patch_url":"https://github.com/nodejs/node/pull/914.patch"},"body":"This basically removes the extra closure previously created by\r\nonce() and instead uses an object to denote a one-time handler.\r\nThe result is ~340% performance increase when adding one-time\r\nhandlers, ~48% performance increase when emitting events with\r\nmixed persistent and one-time handlers, and ~10% performance\r\nincrease when emitting with multiple arguments with mixed handlers,\r\nall with negligible negative performance impact to other EventEmitter\r\nfunctionality.\r\n\r\nAlso, removeListener() was optimized a bit by eliminating handler\r\narrays of length 1 so that the leftover handler is set on\r\n_events[type].\r\n\r\nThe benchmarks from #912 were used when measuring the changes of this PR."},"comment":{"url":"https://api.github.com/repos/nodejs/node/issues/comments/149267416","html_url":"https://github.com/nodejs/node/pull/914#issuecomment-149267416","issue_url":"https://api.github.com/repos/nodejs/node/issues/914","id":149267416,"user":{"login":"mscdex","id":54666,"avatar_url":"https://avatars.githubusercontent.com/u/54666?v=3","gravatar_id":"","url":"https://api.github.com/users/mscdex","html_url":"https://github.com/mscdex","followers_url":"https://api.github.com/users/mscdex/followers","following_url":"https://api.github.com/users/mscdex/following{/other_user}","gists_url":"https://api.github.com/users/mscdex/gists{/gist_id}","starred_url":"https://api.github.com/users/mscdex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mscdex/subscriptions","organizations_url":"https://api.github.com/users/mscdex/orgs","repos_url":"https://api.github.com/users/mscdex/repos","events_url":"https://api.github.com/users/mscdex/events{/privacy}","received_events_url":"https://api.github.com/users/mscdex/received_events","type":"User","site_admin":false},"created_at":"2015-10-19T16:23:24Z","updated_at":"2015-10-19T16:23:24Z","body":"@Fishrock123 I think the main problem will be npm modules that are pegged at particular versions of `readable-stream`. We'd need those modules to either manually update the pegged version (once the `readable-stream` changes would be incorporated simultaneously with node) or to change their version specifier (e.g. to use semver's `^`) so that the backwards incompatible changes would not affect the users of those modules."}}