-
Notifications
You must be signed in to change notification settings - Fork 70
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
Do not allocate for RelativeDistinguishedName
s with just a single attribute
#101
Conversation
465 allocs
This reverts commit 4af11bb.
Conflicts: IntegrationTests/run-tests.sh IntegrationTests/tests_01_allocation_counters/test_01_resources/shared.swift docker/docker-compose.2204.57.yaml docker/docker-compose.2204.58.yaml docker/docker-compose.2204.59.yaml docker/docker-compose.2204.main.yaml
# Conflicts: # IntegrationTests/run-tests.sh # IntegrationTests/tests_01_allocation_counters/test_01_resources/run-swift-certificates-alloc-counter-tests.sh # IntegrationTests/tests_01_allocation_counters/test_01_resources/shared.swift # Tests/X509Tests/TinyArrayTests.swift # docker/docker-compose.2204.57.yaml # docker/docker-compose.2204.58.yaml # docker/docker-compose.2204.59.yaml # docker/docker-compose.2204.main.yaml
and apply review feedback
# Conflicts: # IntegrationTests/tests_01_allocation_counters/test_01_resources/test_tiny_array_cow_append_contents_of.swift # IntegrationTests/tests_01_allocation_counters/test_01_resources/test_tiny_array_non_allocating_operations.swift # Sources/X509/TinyArray.swift # Sources/X509/_TinyArray.swift # Sources/_CertificateInternals/_TinyArray.swift # docker/docker-compose.2204.57.yaml # docker/docker-compose.2204.58.yaml # docker/docker-compose.2204.59.yaml # docker/docker-compose.2204.main.yaml
# Conflicts: # IntegrationTests/tests_01_allocation_counters/test_01_resources/test_tiny_array_cow_append_contents_of.swift # docker/docker-compose.2204.57.yaml # docker/docker-compose.2204.58.yaml # docker/docker-compose.2204.59.yaml # docker/docker-compose.2204.main.yaml
# Conflicts: # docker/docker-compose.2204.57.yaml # docker/docker-compose.2204.58.yaml # docker/docker-compose.2204.59.yaml # docker/docker-compose.2204.main.yaml
# Conflicts: # docker/docker-compose.2204.57.yaml # docker/docker-compose.2204.58.yaml # docker/docker-compose.2204.59.yaml # docker/docker-compose.2204.main.yaml
/// - rootNode: The ``ASN1Node`` to parse | ||
/// - returns: An array of elements representing the elements in the sequence. | ||
@inlinable | ||
public static func lazySet<T: DERParseable>(of: T.Type = T.self, identifier: ASN1Identifier, rootNode: ASN1Node) throws -> some Sequence<Result<T, Error>> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's pretty unfortunate to have to add this, and its supporting code, here: doubly so that we've made it public
. Can we push this down into ASN1?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes sure, I just didn't like that particular name and couldn't come up with a better one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@swift-server-bot test this please |
# Conflicts: # docker/docker-compose.2204.57.yaml # docker/docker-compose.2204.58.yaml # docker/docker-compose.2204.59.yaml
Allocations are reduce by ~7% for parsing certificates 93b35b8 |
|
@swift-server-bot test this please |
API breakage checker failure is a bug in swift: swiftlang/swift#67113 |
} | ||
|
||
@inlinable | ||
init(_ attributes: some Sequence<Result<RelativeDistinguishedName.Attribute, some Error>>) throws { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this to be fully generic? Or can we just accept the actual type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, have changed it: d2ca572
Motivation
A
RelativeDistinguishedName
has almost always just a singleAttribute
but we currently always allocate an array.Modification
_TinyArray
instead ofArray
as the internal storage forAttribute
s inRelativeDistinguishedName
swift-asn1
. We might want to think about porting it back toswift-asn1
but need to think about the right public API for that which we can start in this PR.RelativeDistinguishedName
init can't fail and therefore it is now non-throwing initResult
Allocations have improved