{"action":"created","issue":{"url":"https://api.github.com/repos/nodejs/node/issues/5127","repository_url":"https://api.github.com/repos/nodejs/node","labels_url":"https://api.github.com/repos/nodejs/node/issues/5127/labels{/name}","comments_url":"https://api.github.com/repos/nodejs/node/issues/5127/comments","events_url":"https://api.github.com/repos/nodejs/node/issues/5127/events","html_url":"https://github.com/nodejs/node/pull/5127","id":131940028,"number":5127,"title":"events: improve eventEmitter.once() performance","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/semver-major","name":"semver-major","color":"fbca04"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-02-07T05:50:12Z","updated_at":"2016-02-08T18:11:15Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/nodejs/node/pulls/5127","html_url":"https://github.com/nodejs/node/pull/5127","diff_url":"https://github.com/nodejs/node/pull/5127.diff","patch_url":"https://github.com/nodejs/node/pull/5127.patch"},"body":"This commit improves once() performance by storing the event handler directly instead of creating a wrapper function every time.\r\n\r\nThese changes bring ~150% increase in performance when simply adding once() event handlers, ~220% increase in the included ee-emit-once benchmark, and a ~50% increase in the included ee-add-remove-once benchmark.\r\n\r\nThis PR is #914 rebased on master.\r\n\r\nThe backwards compatibility issue (with directly modifying the private `_events` property) with `readable-stream` still stands however. We would need to get package owners who have a pegged dependency version for `readable-stream` to either bump the version (to the `readable-stream` version containing the changes from this PR) or use a less strict specifier."},"comment":{"url":"https://api.github.com/repos/nodejs/node/issues/comments/181505816","html_url":"https://github.com/nodejs/node/pull/5127#issuecomment-181505816","issue_url":"https://api.github.com/repos/nodejs/node/issues/5127","id":181505816,"user":{"login":"chrisdickinson","id":37303,"avatar_url":"https://avatars.githubusercontent.com/u/37303?v=3","gravatar_id":"","url":"https://api.github.com/users/chrisdickinson","html_url":"https://github.com/chrisdickinson","followers_url":"https://api.github.com/users/chrisdickinson/followers","following_url":"https://api.github.com/users/chrisdickinson/following{/other_user}","gists_url":"https://api.github.com/users/chrisdickinson/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisdickinson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisdickinson/subscriptions","organizations_url":"https://api.github.com/users/chrisdickinson/orgs","repos_url":"https://api.github.com/users/chrisdickinson/repos","events_url":"https://api.github.com/users/chrisdickinson/events{/privacy}","received_events_url":"https://api.github.com/users/chrisdickinson/received_events","type":"User","site_admin":false},"created_at":"2016-02-08T18:11:14Z","updated_at":"2016-02-08T18:11:14Z","body":"I'm still kind of -0 on this - it stands to break anyone that has pegged a version of readable-stream even if we release a patch version of that package. Maybe putting it through CITGM first would be good?\n\n> On Feb 8, 2016, at 9:56 AM, Matteo Collina <notifications@github.com> wrote:\n> \n> Just a quick question: does it introduce some slowdown on normal on() and emit() calls? I see a lot of ifs being added in an hot-path (https://github.com/nodejs/node/pull/5127/files#diff-71dcd327d0ca067b490b22d677f81966R371), which then can complicate V8's job in producing efficient bytecode.\n> \n> Does it impact streams (net, http, fs) as they are? Are those faster (or slower) because of this?\n> \n> —\n> Reply to this email directly or view it on GitHub.\n> \n"}}