-
Notifications
You must be signed in to change notification settings - Fork 9
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
feat!: yield uint8arraylists #65
Conversation
1459675
to
8495ae3
Compare
N.b depends on |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #65 +/- ##
==========================================
- Coverage 95.60% 95.60% -0.01%
==========================================
Files 14 14
Lines 2207 2206 -1
Branches 329 329
==========================================
- Hits 2110 2109 -1
Misses 97 97
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
The general pattern of stream muxers is to yield protocol stream data framed by some additional metadata - stream id, flags, etc. The frame data can be prepended/appended to the protocol stream data by using a `Uint8ArrayList` instead of a `Uint8Array`, this removes the need to copy the protocol data into a new `Uint8Array` for every frame. The new `@libp2p/interface` version allows muxers to emit `Uint8ArrayList`s as well as `Uint8Array`s so we can send protocol stream data to a transport in a no-copy operation.
8495ae3
to
9a48fd3
Compare
🎉 This PR is included in version 6.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
The general pattern of stream muxers is to yield protocol stream data framed by some additional metadata - stream id, flags, etc.
The frame data can be prepended/appended to the protocol stream data by using a
Uint8ArrayList
instead of aUint8Array
, this removes the need to copy the protocol data into a newUint8Array
for every frame.The new
@libp2p/interface
version allows muxers to emitUint8ArrayList
s as well asUint8Array
s so we can send protocol stream data to a transport in a no-copy operation.In particular yielding a single
Uint8ArrayList
with the frame header plus the data buffer gets us close to that target 200ms connection establishment time:BREAKING CHANGE: requires
js-libp2p@1.0.0