Skip to content

Conversation

@jasnell
Copy link
Member

@jasnelljasnell commented Feb 13, 2017

Self-explanatory ... avoid unnecessary uses of arguments

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

dns

@nodejs-github-botnodejs-github-bot added the dns Issues and PRs related to the dns subsystem. label Feb 13, 2017
@ChALkeR
Copy link
Member

Does this have any effect on benchmarks?
LGTM if it doesn't slow anything down (it shouldn't according to #11357).

Copy link
Member

@mhdawsonmhdawson left a comment

Choose a reason for hiding this comment

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

LGTM

@jasnell
Copy link
MemberAuthor

CI: https://ci.nodejs.org/job/node-test-pull-request/6417/
@ChALkeR ... I don't believe we have any benchmarks for dns so it's difficult to say.

Copy link
Member

@targostargos left a comment

Choose a reason for hiding this comment

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

LGTM with a suggestion (untested perf-wise)

if(asyncCallback.immediately){
// The API already returned, we can invoke the callback immediately.
callback.apply(null,arguments);
callback.apply(null,args);
Copy link
Member

Choose a reason for hiding this comment

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

I'd rewrite to callback(...args)

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Spread arguments still appear to be quite a bit slower according to benchmarks. Even the ...args has mixed results that I haven't quite been able to track down the cause of.

for(vari=0;i<arguments.length;++i)
args[i+1]=arguments[i];
args.unshift(callback);
process.nextTick.apply(null,args);
Copy link
Member

Choose a reason for hiding this comment

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

And process.nextTick(callback, ...args)

jasnell added a commit that referenced this pull request Feb 15, 2017
PR-URL: #11359 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Сковорода Никита Андреевич <[email protected]
@jasnell
Copy link
MemberAuthor

Landed e36d0d3

@jasnelljasnell closed this Feb 15, 2017
@notarseniynotarseniy mentioned this pull request Feb 16, 2017
2 tasks
italoacasas pushed a commit to italoacasas/node that referenced this pull request Feb 16, 2017
PR-URL: nodejs#11359 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Сковорода Никита Андреевич <[email protected]
italoacasas pushed a commit that referenced this pull request Feb 22, 2017
PR-URL: #11359 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Сковорода Никита Андреевич <[email protected]
@italoacasasitaloacasas mentioned this pull request Feb 25, 2017
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dnsIssues and PRs related to the dns subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@jasnell@ChALkeR@lpinca@targos@mhdawson@nodejs-github-bot