Skip to content
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

deps!: update all deps to support no-copy operations #1335

Merged
merged 3 commits into from
Aug 11, 2022

Conversation

achingbrain
Copy link
Member

@achingbrain achingbrain commented Aug 11, 2022

Updates all deps needed to support passing lists of byte arrays where they have been created from multiple input buffers.

When reading multiplexed data, all messages arrive in length-prefixed buffers, which means the first few bytes tell the consumer how many bytes long next chunk will be.

One length prefixed chunk can be delivered in several payloads from the underlying network transport. The first payload can also include the length prefix and some or all of the data, so we stitch these together in a Uint8ArrayList to avoid having to concatenate Uint8Arrays together.

Previously once we'd received enough bytes to satisfy the length prefix we'd concatenate the bytes together, but this is a potentially expensive operation where transports have small message sizes so instead just pass the Uint8ArrayList to the consumer and let them decide wether to concatenate or not as some consumers will be smart enough to operate on lists of Uint8Arrays instead of always requiring a contiguous block of memory.

BREAKING CHANGE: Streams are now Duplex<Uint8ArrayList, Uint8ArrayList | Uint8Array>

Updates all deps needed to support passing lists of byte arrays
where they have been created from multiple input buffers.
@achingbrain achingbrain mentioned this pull request Aug 11, 2022
@achingbrain achingbrain changed the title deps: update all deps to support no-copy operations deps!: update all deps to support no-copy operations Aug 11, 2022
@achingbrain achingbrain merged commit f439d9b into master Aug 11, 2022
@achingbrain achingbrain deleted the fix/update-deps branch August 11, 2022 12:21
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