Skip to content

SwiftNetwork: PERF: Optimize UDP checksum16 - #120

Open
agnosticdev wants to merge 2 commits into
mainfrom
agnosticdev/OptimizeChecksum16
Open

SwiftNetwork: PERF: Optimize UDP checksum16#120
agnosticdev wants to merge 2 commits into
mainfrom
agnosticdev/OptimizeChecksum16

Conversation

@agnosticdev

Copy link
Copy Markdown
Collaborator

This is a small optimization for UDP checksum16 . This change removes roughly 25% of the checksum instructions but we only see a small win of around 14% in the QUICTransfer benchmark:

// Before
768.13 M 100.0%	-	 checksum16()

// After
680.36 M 100.0%	-	 checksum16()

Assembly look:
https://godbolt.org/z/GzWP1ea75

@agnosticdev
agnosticdev requested a review from rpaulo August 27, 2026 23:57
@agnosticdev agnosticdev added the 🔨 semver/patch No public API change. label Aug 27, 2026
}

enum ChecksumError: Error {
@available(Network 0.1.0, *)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Who needs to know how the checksum failed?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needed for inlining.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. Do we want to expose it just because of inlining though?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like I never tried usableFromInline :-)

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.

2 participants