Conversation
Every packet that carries stream data records which stream sends it carried in `TransmittedItems.sentStreams`, and keeps the record until the packet is acknowledged or declared lost. The record was an array, so each such packet allocated storage for it, though a packet almost always carries one stream. `SentStreams` keeps the first send inline and only allocates for the rest. `SentStream` holds nothing but values, so it is now copyable, which lets the inline slot be an ordinary optional. Measured on my Mac against `main` with the package's QUIC benchmark tools. Allocation counts come from full malloc stack logging, which records every allocation: QUICTransfer -size 1200, per message 24.37 -> 23.31 QUICTransfer, per 500 KB transfer 6,187.6 -> 5,747.9 QUICHandshake, per connection 1,947.4 -> 1,944.8 QUICStreamLoad, per stream 111.8 -> 109.8 The stream load still allocates for a second send in about one packet in seventeen. Wall-clock time comes from running `main`, this change and the other changes measured alongside it in a rotating order for 9 rounds, and comparing each run with `main`'s in the same round. Changes moved paths they do not touch by up to about 1.3%, so differences that size count as noise. Nothing changed beyond noise.
rnro
requested review from
agnosticdev,
kkuk24,
rpaulo and
tfpauly
as code owners
October 1, 2026 19:54
tfpauly
reviewed
Oct 1, 2026
| var sentStreams = NetworkUniqueArray<SentStream>() | ||
|
|
||
| /// The stream sends a packet carried. | ||
| /// |
Collaborator
There was a problem hiding this comment.
Seems like this could use the UniqueSmallArray from here: https://github.com/apple/swift-network-evolution/pull/131/changes#diff-e7c6fbc146fbc07403b5f53246149d02bb76bdd57e3ee7f871263abd3206e9cf
Which was waiting on swiftlang/swift#91664
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every packet that carries stream data records which stream sends it carried in
TransmittedItems.sentStreams, and keeps the record until the packet isacknowledged or declared lost. The record was an array, so each such packet
allocated storage for it, though a packet almost always carries one stream.
SentStreamskeeps the first send inline and only allocates for the rest.SentStreamholds nothing but values, so it is now copyable, which lets theinline slot be an ordinary optional.
Measured on my Mac against
mainwith the package's QUIC benchmark tools.Allocation counts come from full malloc stack logging, which records every
allocation:
The stream load still allocates for a second send in about one packet in
seventeen.
Wall-clock time comes from running
main, this change and the other changesmeasured alongside it in a rotating order for 9 rounds, and comparing each run
with
main's in the same round. Changes moved paths they do not touch by up toabout 1.3%, so differences that size count as noise. Nothing changed beyond
noise.