Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib: refactor events.js #36528

Conversation

RaisinTen
Copy link
Contributor

@RaisinTen RaisinTen commented Dec 15, 2020

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

@nodejs-github-bot nodejs-github-bot added the events Issues and PRs related to the events subsystem / EventEmitter. label Dec 15, 2020
@@ -200,7 +200,7 @@ EventEmitter.init = function(opts) {
this._maxListeners = this._maxListeners || undefined;


if (opts && opts.captureRejections) {
if (opts?.captureRejections) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll need to benchmark these changes. The entire events.js file is one of the most performance sensitive in core and changes here can have massive impact throughout. Last I benchmarked, optional chaining still had some performance lag that hadn't been fully optimized out. That's not a block on this on it's own but let's be sure to run benchmarks before this lands.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm also not a fan of the optional chaining operator. I think it hinders readability.

@Lxxyx
Copy link
Member

Lxxyx commented Dec 15, 2020

The pull request is duplicate with #36304.

I know this because just last night, I closed a Pull Request for the same(#36517) 😂

@RaisinTen
Copy link
Contributor Author

@Lxxyx whoops, thanks for telling :)

@RaisinTen RaisinTen closed this Dec 16, 2020
RaisinTen added a commit to RaisinTen/node that referenced this pull request Dec 16, 2020
@aduh95
Copy link
Contributor

aduh95 commented Dec 16, 2020

@RaisinTen BTW if you want to help me resolve the perf regressions of #36304, that's be awesome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
events Issues and PRs related to the events subsystem / EventEmitter.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants