Skip to content

SwiftQUIC: PERF: Adopt NetworkSmallUniqueArray to avoid heap allocations for FrameAck - #234

Open
agnosticdev wants to merge 4 commits into
mainfrom
agnosticdev/FrameAckStorage
Open

agnosticdev wants to merge 4 commits into
mainfrom
agnosticdev/FrameAckStorage

Conversation

@agnosticdev

Copy link
Copy Markdown
Collaborator

Adopt NetworkSmallUniqueArray to try and avoid hitting the heap when parsing ack ranges.
This is only setup for 2 ranges at the moment and anything after that will fail over to being stored in a heap back collection.
The size of 2 was chosen to make sure the memory layout of SentPacketRecord does not blow up because this can have a CPU impact when creating these structs.

When running QUICTransfer we see this now completely removed:

0	_ContiguousArrayStorage<FrameAckRange>	0 Bytes	0	2186	102.47 KiB	2186	Ratio: %0.00, %0.00

I have also verified that this did not regress CPU:

QUICStreadLoad Top of tree:
56.71 G 100.0%	-	 QUICStreamLoad (10374)	
56.89 G 100.0%	-	 QUICStreamLoad (10377)	
56.31 G 100.0%	-	 QUICStreamLoad (10385)	

QUICStreadLoad With Change:
56.22 G 100.0%	-	 QUICStreamLoad (12540)	
56.22 G 100.0%	-	 QUICStreamLoad (12539)	
56.45 G 100.0%	-	 QUICStreamLoad (12533)	


QUICTransfer 1000 transfers top of tree:
3.89 G 100.0%	-	 QUICTransfer (4455)	
3.88 G 100.0%	-	 QUICTransfer (4457)	
3.86 G 100.0%	-	 QUICTransfer (4468)	


QUICTransfer 1000 transfers with change:
3.89 G 100.0%	-	 QUICTransfer (12527)	
3.87 G 100.0%	-	 QUICTransfer (12526)	
3.87 G 100.0%	-	 QUICTransfer (12525)	

@agnosticdev
agnosticdev requested a review from rnro October 8, 2026 22:55
@agnosticdev agnosticdev added the 🔨 semver/patch No public API change. label Oct 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🔨 semver/patch No public API change.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant