Skip to content

Used vendored base64 encoding implementation rather than Foundation.Data #539

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

Merged
merged 1 commit into from
Jan 21, 2022

Conversation

karwa
Copy link
Contributor

@karwa karwa commented Jan 10, 2022

Uses @fabianfett's base64 implementation rather than Foundation. Apparently it's faster, and it avoids copying the string to a Foundation.Data object before encoding.

Single-file version copied from https://github.com/apple/swift-nio/blob/main/Sources/NIOWebSocket/Base64.swift

I disabled swiftformat on the file so that, other than the copyright header and swiftformat comment, it remains identical to the version in NIO. Alternatively, we could add a package dependency rather than copying the file. Up to you guys.

With this and #534, the only remaining Foundation dependencies will be URL, and the couple of convenience APIs in the FoundationExtensions file. If they're both accepted, I can go through and replace all occurrences of import Foundation with import struct Foundation.URL in a follow-up.

There are already tests for this API, so I didn't feel it necessary to add any.

Copy link
Collaborator

@Lukasa Lukasa left a comment

Choose a reason for hiding this comment

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

Seems reasonable to me, @fabianfett?

@karwa
Copy link
Contributor Author

karwa commented Jan 17, 2022

Hey @fabianfett, mind taking a look at this when you get time? Thanks!

Copy link
Member

@fabianfett fabianfett left a comment

Choose a reason for hiding this comment

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

Sorry for taking so long to review. The code change looks good. @Lukasa how do we deal with adding a Note to the Notice file, as the original repo does not exist anymore?

@Lukasa
Copy link
Collaborator

Lukasa commented Jan 21, 2022

Copy the note from NIO.

@fabianfett
Copy link
Member

@karwa Do you mind copying the note from NIO's NOTICE file?

@karwa
Copy link
Contributor Author

karwa commented Jan 21, 2022

@fabianfett done

@fabianfett
Copy link
Member

Failing nightly-main and nightly-5.6 API because of missing Sendable requirements.

@fabianfett fabianfett merged commit 609b436 into swift-server:main Jan 21, 2022
@fabianfett fabianfett added the 🔨 semver/patch No public API change. label Jan 24, 2022
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.

3 participants