Skip to content
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

Implement TinyArray #98

Merged
merged 12 commits into from Jun 20, 2023
Merged

Implement TinyArray #98

merged 12 commits into from Jun 20, 2023

Conversation

dnadoba
Copy link
Member

@dnadoba dnadoba commented Jun 16, 2023

We want to improve allocations for a couple of collections that are only ever expected to store a single element. However, in rare cases they might store multiple elements so they still need to support that.

@dnadoba dnadoba added the needs-no-version-bump For PRs that when merged do not need a bump in version number. label Jun 16, 2023
Sources/X509/TinyArray.swift Outdated Show resolved Hide resolved
Sources/X509/TinyArray.swift Outdated Show resolved Hide resolved
Sources/X509/TinyArray.swift Outdated Show resolved Hide resolved
Comment on lines 115 to 113
// we don't use lhs.elementsEqual(rhs) so we can hit the fast path from Array
// if both arrays share the same underlying storage: https://github.com/apple/swift/blob/b42019005988b2d13398025883e285a81d323efa/stdlib/public/core/Array.swift#L1775
Copy link
Collaborator

Choose a reason for hiding this comment

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

neat!

Sources/X509/TinyArray.swift Outdated Show resolved Hide resolved
Sources/X509/TinyArray.swift Outdated Show resolved Hide resolved
Sources/X509/TinyArray.swift Outdated Show resolved Hide resolved
Sources/X509/TinyArray.swift Outdated Show resolved Hide resolved
@dnadoba dnadoba requested a review from Lukasa June 19, 2023 15:08
and apply review feedback
@dnadoba dnadoba requested a review from yim-lee June 19, 2023 18:01
@dnadoba dnadoba requested a review from Lukasa June 20, 2023 07:39
@dnadoba dnadoba enabled auto-merge (squash) June 20, 2023 08:47
@dnadoba dnadoba merged commit 41dff30 into apple:main Jun 20, 2023
4 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-no-version-bump For PRs that when merged do not need a bump in version number.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants