| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| }); | ||
|
|
||
| Object.defineProperty(Socket.prototype, kUpdateTimer, { | ||
| get: function() { |
There was a problem hiding this comment.
We should probably avoid getters for hot paths like a socket read callback function.
Sorry, something went wrong.
There was a problem hiding this comment.
I wouldn’t expect it to make a big difference? I’d expect V8 to inline this – if benchmark runs come back okay, is this still an issue?
That being said, it might be nice to move over to using kUpdateTimer in all cases.
Sorry, something went wrong.
| } | ||
|
|
||
| function _onread(handle, stream, nread, buf) { | ||
| stream[kUpdateTimer](); |
There was a problem hiding this comment.
Isn't this deviating from http2's original implementation? Previously for http2 this was only called inside the conditional below.
Sorry, something went wrong.
There was a problem hiding this comment.
I don’t think that’s an issue either, and arguably a bit more correct this way.
Sorry, something went wrong.
| } | ||
|
|
||
| // Last chunk was received. End the readable side. | ||
| debug(`Http2Stream ${stream[kID]} [Http2Session ` + |
There was a problem hiding this comment.
This is missing in the new implementation
Sorry, something went wrong.
|
I'm not sure how feasible it is to do a proper job of merging these. HTTP2 has pretty different requirements here. The bits that are shared are actually quite minimal (basically the first if and even then there's extra debugging calls & properties that are not shared). |
Sorry, something went wrong.
| function _onread(handle, stream, nread, buf) { | ||
| stream[kUpdateTimer](); | ||
|
|
||
| if (nread > 0 && !stream.destroyed) { |
There was a problem hiding this comment.
This is not the same as the previous http2 implementation, which executed the logic within this block when nread >= 0, not just nread > 0.
Sorry, something went wrong.
There was a problem hiding this comment.
I don’t think omitting 0-sized reads is an issue.
Sorry, something went wrong.
|
I agree, there seems to be subtle differences that would make merging difficult, especially efficiently. |
Sorry, something went wrong.
| class ServerHttp2Stream extends Http2Stream { | ||
| constructor(session, handle, id, options, headers) { | ||
| super(session, options); | ||
| handle.owner = this; |
There was a problem hiding this comment.
I think it might be better to attach [kOwner] in net.js (and later switching over to always using that symbol over there)
Generally, it would imo be a good idea to have a standardized way to access the JS wrapper object from a C++ handle, and handle[kOwner] might be exactly that
Sorry, something went wrong.
|
@aks- Thanks for doing this! I’m sorry I didn’t reply sooner, feel free to @ me if you like. Could you rebase this against master? I’ll try to look into the test failures (if they are still there) |
Sorry, something went wrong.
There was a problem hiding this comment.
I think having benchmark results would be good considering some of the changes being made here.
Sorry, something went wrong.
|
@ryzokuken Do you maybe have the time to look at this? |
Sorry, something went wrong.
|
@addaleax will take a look tonight, sure! |
Sorry, something went wrong.
Refs: nodejs#20993 Co-authored-by: Anna Henningsen <anna@addaleax.net>
|
Done! |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Checklist