-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
perf(ext/node): native vectored write for server streams #19752
Conversation
littledivy
commented
Jul 7, 2023
•
edited
Loading
edited
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but I want more eyes on this. Pinging @mmastrac for additional review.
if (typeof chunks[0] === "string") chunks[0] = Buffer.from(chunks[0]); | ||
if (typeof chunks[1] === "string") chunks[1] = Buffer.from(chunks[1]); | ||
|
||
ops.op_raw_write_vectored( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this path called with chunks.length == 1
anywhere? There may be an opportunity to optimize for N <= M instead of N == 2.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
chunks.length == 1
should be using write
instead of writev
buf1: JsBuffer, | ||
buf2: JsBuffer, | ||
) -> Result<usize, AnyError> { | ||
let resource: Rc<UpgradeStream> = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is not an UpgradeStream
, it should probably fall back to the standard write methods. I don't think we should assume that any two-chunk write is a websocket write.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In JS, All TCPSERVERWRAP
provider type resources are an UpgradeStream so this does not need a fallback.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Let's land for now and work on vectorizing resources