GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||
GeezerVison is showing github.com — lib: refactor stream_wrap by addaleax · Pull Request #16158 · nodejs/node Conversation
Member
Another first step into making parts of the code base more accessible. Checklist
Affected core subsystem(s)lib/
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
fhinkel
reviewed
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add an
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Never mind, this is not an exhaustive if else.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
fhinkel
reviewed
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. on a network resource or on network resources.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
fhinkel
reviewed
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: change to active voice:
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
jasnell
reviewed
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need to be certain that the change to the ES6 class is not going to break the planet, here.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we are, there is no constructor without new in the original one.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. Also, this class exposes only limited functionality – you effectively can’t use it for any other purpose than what Node core does.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok. I can't come up with anything specific that would break so I'm ++
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
jasnell
reviewed
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do these really need to be closures?
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. They were before. Can we defer optimizing to later work?
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
fhinkel
reviewed
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Super-Nit: period at the end of the comment.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
fhinkel
approved these changes
Member
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
mcollina
reviewed
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Very good work! I think we can take the refactoring a bit further and avoid some closure allocations.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would deprecate this file, people should not be requiring this in any form.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we go with semver-major, yes.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we are, there is no constructor without new in the original one.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. some of those would be better of to be
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would prefer if we could optimize this function so that it's not a closure anymore, but a top level function.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we avoid allocating two closures for every write? I know it would make the code uglier, but it's probably the right moment to do. The innermost can be replaced by a top-level function with handle, item, req and errCode as parameters. The top-level one can be allocated in the constructor, and we can store
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this function should really be top-level. The while loop can really get cpu-intensive.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Member
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
|
There was an error while loading. Please reload this page.
|
@mcollina We can talk about optimizations, but this isn’t creating any new closures – can we avoid nitpicking for an actual PR that does those optimizations? Also, to reiterate what the comment states: This is the slow path. Optimizing this doesn’t actually have much real-world impact. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Marking it semver-major out of principle and an abundance of caution. I'm good with it landing as a patch, but we should do a small amount of due diligence first. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Yeah, we can wait for an npm search for it. :) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Currently git is not marking these files as moved, but rather as new files. If this is marked semver-major, this makes sense, and we can as well refactor and improve them. I think we should land this as semver-major, and spend a little more time improving this. I propose you keep the first commit in this PR. Once that is landed, we do another PR with the ES6 refactoring and we deprecate the old file. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Definitely agree with @mcollina about wanting to avoid the closures if possible (looking them over, it should definitely be easily possible). |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I don’t disagree about avoiding closures in general, but I would really say that’s not the scope of this PR. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Also, if this is semver-major, could you give a hypothetical example of code that might break? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
There likely isn't any, again it's only defensive. Now that I've had a moment free to do a search on github and Google and I'm not seeing anything of any concern. If we cannot really identify anything that would break, I'm good with dropping the major label. I disagree on the closure bit but I can open a separate pr that handles that. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I’ll at least try to get @ChALkeR’s tooling to run again, it might be nice anyway if somebody else had practice in that (and I know I got it to build at least once) :) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
8fc47f2 to
4cd793f
Compare
|
CI: https://ci.nodejs.org/job/node-test-commit/13229/ |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
This makes a subsequent possible deprecation easier. PR-URL: nodejs#16158 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]>
This makes a subsequent possible deprecation easier. PR-URL: nodejs#16158 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]> Reviewed-By: Tobias Nießen <[email protected]>
PR-URL: nodejs#16158 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]> Reviewed-By: Tobias Nießen <[email protected]>
This makes a subsequent possible deprecation easier. PR-URL: #16158 Backport-PR-URL: #16626 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]> Reviewed-By: Tobias Nießen <[email protected]>
PR-URL: #16158 Backport-PR-URL: #16626 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]> Reviewed-By: Tobias Nießen <[email protected]>
This makes a subsequent possible deprecation easier. PR-URL: #16158 Backport-PR-URL: #16626 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]> Reviewed-By: Tobias Nießen <[email protected]>
PR-URL: #16158 Backport-PR-URL: #16626 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]> Reviewed-By: Tobias Nießen <[email protected]>
|
@addaleax I've added the don't land label for 6.x... lmk if we should change that |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
This makes a subsequent possible deprecation easier. PR-URL: nodejs/node#16158 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]> Reviewed-By: Tobias Nießen <[email protected]>
PR-URL: nodejs/node#16158 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]> Reviewed-By: Tobias Nießen <[email protected]>
Its unused by node, and doesn't have a reasonable use outside of node. See: nodejs#25153 See: nodejs#16158
Its unused by node, and doesn't have a reasonable use outside of node. See: #25153 See: #16158 PR-URL: #26245 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Tobias Nießen <[email protected]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.