Skip to content

Conversation

@alexlamsl
Copy link
Contributor

If encoding is set, no Buffers would be exposed thus Uint8Array can be used directly.

Measured 15% performance increase with tcp-echo.node.mjs

Verified with:

  • child-process-stdio.test.js
  • fs.test.js with 1 pre-existing failure
  • node-net.test.ts
  • node-stream.test.js
  • process-stdio.test.ts

@Jarred-Sumner
Copy link
Collaborator

I wonder if we could do this for any ArrayBufferView since StringDecoder is allowed to be used with any ArrayBufferView

@alexlamsl
Copy link
Contributor Author

I think the answer is yes, though I couldn't come up with any (common) use cases for that.

May be extend further support when the time comes? 🤔

@alexlamsl alexlamsl force-pushed the streams-uint8array branch 2 times, most recently from e731c7e to c6cea6e Compare January 3, 2023 22:44
@alexlamsl alexlamsl changed the title [streams] speed up Readable in some cases [WIP] [streams] speed up Readable in some cases Jan 3, 2023
If `encoding` is set, no `Buffer`s would be exposed thus `Uint8Array` can be used directly.

- fix data corruption in `BufferList.concat()`
- fix segfaults in `BufferList.join()`
@alexlamsl alexlamsl changed the title [WIP] [streams] speed up Readable in some cases [streams] speed up Readable in some cases Jan 3, 2023
@Jarred-Sumner Jarred-Sumner merged commit 237bcdf into oven-sh:main Jan 4, 2023
@alexlamsl alexlamsl deleted the streams-uint8array branch January 4, 2023 00:08
Jarred-Sumner pushed a commit that referenced this pull request Jan 6, 2023
If `encoding` is set, no `Buffer`s would be exposed thus `Uint8Array` can be used directly.

- fix data corruption in `BufferList.concat()`
- fix segfaults in `BufferList.join()`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants