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 — net,http2: refactor _write and _writev in net.Socket and http2.Http2Stream by ryzokuken · Pull Request #20643 · nodejs/node Conversation
|
|
I'm concerned about making the That logic needs tidy up anyway, so let's find a way to keep the number of arguments consistent. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@mcollina You mean That said, please share whatever you have in mind and hopefully we would be able to make it a tad faster and simpler. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
My bad, I misread a |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
That's what I did the first time around too 😅, but yeah. They're different functions, so I hope everything is fine, right? Should I proceed? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
A few questions:
-- more to come -- |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
okay, tests pass so I'm keeping it here until someone asks me to remove it. One more thing: Why does this.once('connect', function connect() { this._writeGeneric(writev, data, encoding, cb); }); even though normal functions have their own |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Tests pass again, I'm either making progress, or we have weak test cases. Two things next:
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Okay, when it comes to the actual logic for refreshing timers, they're both quite similar. In Socket.prototype._unrefTimer = function _unrefTimer() { for (var s = this; s !== null; s = s._parent) { if (s[kTimeout]) s[kTimeout][refreshFnSymbol](); } }; and in [kUpdateTimer]() { if (this.destroyed) return; if (this[kTimeout]) this[kTimeout][refreshFnSymbol](); if (this[kSession]) this[kSession][kUpdateTimer](); } for now, the least I think I could do is switch from the iterative approach in |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Okay, it wasn't recursing, but rather refreshing the associated |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
1732c4f to
1257d56
Compare
There was an error while loading. Please reload this page.
|
Current roadblocks (inconsistencies):
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Maybe something that we also want in HTTP/2? Anyway, this LGTM as is and I’d be okay with landing this as-is and iterating onwards from there. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I haven't had a chance to fully review but 2 things off the top:
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
While we may not need the properties yet, I believe they could prove helpful while fleshing out future behavior. Anyway, let me know if the added cruft of two simple properties would be worth a little consistency and nifty properties that could be used in the future (or perhaps even right now).
While I think I could just move to a Symbol pretty easily, I don't think it should be a problem because:
That said, if you insist, I will make that change.
Again, I made the change only to make things a tad more consistent, and you have a much better idea that me how this could affect speed in the long term. If you say, I could revert that particular part back to the original. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
The fact that _writeGeneric is exposed on the Socket is just bad behaviour we're stuck with — it comes from a time when we didn't have many options for hiding private properties and methods. Now we do and since it's a private implementation detail, it shouldn't leak to the user. As for
I don't think things need to be more consistent between those two functions. I get the point of making _write and _writev more consistent, I don't think any unrelated functions need to be. As far as how it's slower: calling a function (adding it to the stack) is slower than just a loop and since it's now recursive there's no way it can get inlined by V8. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Get it, loop would definitely be faster. That said, I'm thinking: as long as the two classes each have an exposed function (maybe called
It seems that'll no longer be a problem once I'm done with this (same with it being exposed on |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Keep in mind that there would be the same issue with exposing |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
@apapirovski could we not expose it but still call it from a base class, somehow? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@apapirovski @addaleax This looks better, I suppose? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
LGTM. Could also be a separate function to avoid the symbol lookup when calling it but this is fine as the first version. _unrefTimer still needs to be reverted. Then we could likely land this and iterate from there. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@apapirovski reverting |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@BridgeAR okay! In that case, this is ready to merge. Awaiting @apapirovski's explicit approval before landing. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks for working on this!
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@apapirovski Thanks for all the constructive feedback and guidance! Will land this today. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Landing this. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Refactor writable part (the _write and _writev functions) in net.Socket and http2.Http2Stream classes. Also involves adding a generic "WriteGeneric" method to the Http2Stream class based on net.Socket._writeGeneric, but behind a symbol.
|
Squashing and running CI, will land in the morning. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
9cf4830 to
334f044
Compare
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Landed in a7fa0db |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Refactor writable part (the _write and _writev functions) in net.Socket and http2.Http2Stream classes. Also involves adding a generic "WriteGeneric" method to the Http2Stream class based on net.Socket._writeGeneric, but behind a symbol. PR-URL: #20643 Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
Refactor writable part (the _write and _writev functions) in net.Socket and http2.Http2Stream classes. Also involves adding a generic "WriteGeneric" method to the Http2Stream class based on net.Socket._writeGeneric, but behind a symbol. PR-URL: #20643 Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
Refactor writable part (the _write and _writev functions) in net.Socket and http2.Http2Stream classes. Also involves adding a generic "WriteGeneric" method to the Http2Stream class based on net.Socket._writeGeneric, but behind a symbol. PR-URL: nodejs#20643 Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
Refactor writable part (the _write and _writev functions) in net.Socket and http2.Http2Stream classes. Also involves adding a generic "WriteGeneric" method to the Http2Stream class based on net.Socket._writeGeneric, but behind a symbol. PR-URL: nodejs#20643 Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
Refactor writable part (the _write and _writev functions) in net.Socket and http2.Http2Stream classes. Also involves adding a generic "WriteGeneric" method to the Http2Stream class based on net.Socket._writeGeneric, but behind a symbol. PR-URL: nodejs#20643 Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
Refactor writable part (the _write and _writev functions) in net.Socket and http2.Http2Stream classes. Also involves adding a generic "WriteGeneric" method to the Http2Stream class based on net.Socket._writeGeneric, but behind a symbol. Backport-PR-URL: #22850 PR-URL: #20643 Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Ruben Bridgewater <[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.