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

net: remove redundant code from _writeGeneric() #18429

Closed
wants to merge 1 commit into from

Conversation

lpinca
Copy link
Member

@lpinca lpinca commented Jan 29, 2018

The encoding is already handled by Writable.prototype.write().

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)

net

The encoding is already handled by `Writable.prototype.write()`.
@nodejs-github-bot nodejs-github-bot added the net Issues and PRs related to the net subsystem. label Jan 29, 2018
@mcollina
Copy link
Member

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@cjihrig cjihrig left a comment

Choose a reason for hiding this comment

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

LGTM. We might want to run CITGM though, in case any popular modules are calling _writeGeneric() directly.

@lpinca
Copy link
Member Author

lpinca commented Jan 29, 2018

@lpinca
Copy link
Member Author

lpinca commented Jan 30, 2018

I can't spot any noticeable difference from the previous CITGM run.

On a side note: I noticed that Socket.prototpe._writeGeneric() is a "hot" function profiling a basic net echo server (10k roundtrips of 64 B - binary data). Instantiating a WriteWrap is expensive but I'm not sure if it's that or if we can do anything about this.

@mcollina
Copy link
Member

On a side note: I noticed that Socket.prototpe._writeGeneric() is a "hot" function profiling a basic net echo server (10k roundtrips of 64 B - binary data). Instantiating a WriteWrap is expensive but I'm not sure if it's that or if we can do anything about this.

_writeGeneric is one of hottest functions in core. I think part of the problem is it being 'generic', as it's in the path for both _write and _writev flows. This function has to instantiate a WriteWrap.

@lpinca
Copy link
Member Author

lpinca commented Jan 30, 2018

Yes I think that instantiating WriteWrap is what makes it slow but I may be wrong.

@BridgeAR BridgeAR added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Feb 1, 2018
@lpinca
Copy link
Member Author

lpinca commented Feb 3, 2018

Landed in f8fda0d.

lpinca added a commit that referenced this pull request Feb 3, 2018
The encoding is already handled by `Writable.prototype.write()`.

PR-URL: #18429
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
@lpinca lpinca closed this Feb 3, 2018
@lpinca lpinca deleted the remove/redundant-code branch February 3, 2018 15:22
@addaleax addaleax removed the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Feb 4, 2018
MylesBorins pushed a commit that referenced this pull request Feb 20, 2018
The encoding is already handled by `Writable.prototype.write()`.

PR-URL: #18429
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
MylesBorins pushed a commit that referenced this pull request Feb 21, 2018
The encoding is already handled by `Writable.prototype.write()`.

PR-URL: #18429
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
MylesBorins pushed a commit that referenced this pull request Feb 21, 2018
The encoding is already handled by `Writable.prototype.write()`.

PR-URL: #18429
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
@MylesBorins MylesBorins mentioned this pull request Feb 21, 2018
@MylesBorins
Copy link
Member

@lpinca does this apply to 6.x or 8.x?

@lpinca
Copy link
Member Author

lpinca commented Mar 20, 2018

Yes, it applies to both 6.x and 8.x. Let me know if it doesn't apply cleanly.

MylesBorins pushed a commit that referenced this pull request Mar 20, 2018
The encoding is already handled by `Writable.prototype.write()`.

PR-URL: #18429
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
MylesBorins pushed a commit that referenced this pull request Mar 21, 2018
The encoding is already handled by `Writable.prototype.write()`.

PR-URL: #18429
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
MylesBorins pushed a commit that referenced this pull request Mar 28, 2018
The encoding is already handled by `Writable.prototype.write()`.

PR-URL: #18429
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
MylesBorins pushed a commit that referenced this pull request Mar 28, 2018
The encoding is already handled by `Writable.prototype.write()`.

PR-URL: #18429
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
MylesBorins pushed a commit that referenced this pull request Mar 30, 2018
The encoding is already handled by `Writable.prototype.write()`.

PR-URL: #18429
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
MylesBorins pushed a commit that referenced this pull request Mar 30, 2018
The encoding is already handled by `Writable.prototype.write()`.

PR-URL: #18429
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
@MylesBorins MylesBorins mentioned this pull request Apr 13, 2018
@MylesBorins MylesBorins mentioned this pull request May 2, 2018
MayaLekova pushed a commit to MayaLekova/node that referenced this pull request May 8, 2018
The encoding is already handled by `Writable.prototype.write()`.

PR-URL: nodejs#18429
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
net Issues and PRs related to the net subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants