Skip to content

Commit fec9719

Browse files
fabianfettglbrntt
andauthored
NIOThrowingAsyncSequenceProducer make more funcs @inlinable (#3243)
When working on performance in PostgresNIO I noticed a few `_swift_getGenericMetadata`s. We don't like those. I could trace them down to `NIOThrowingAsyncSequenceProducer`. All methods on this object are generic, since the object itself is generic. Co-authored-by: George Barnett <[email protected]>
1 parent 355bc48 commit fec9719

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

Sources/NIOCore/AsyncSequences/NIOThrowingAsyncSequenceProducer.swift

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public struct NIOThrowingAsyncSequenceProducer<
4848
/// The actual sequence which should be passed to the consumer.
4949
public let sequence: NIOThrowingAsyncSequenceProducer
5050

51-
@usableFromInline
51+
@inlinable
5252
internal init(
5353
source: Source,
5454
sequence: NIOThrowingAsyncSequenceProducer
@@ -218,6 +218,7 @@ public struct NIOThrowingAsyncSequenceProducer<
218218

219219
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
220220
extension NIOThrowingAsyncSequenceProducer: AsyncSequence {
221+
@inlinable
221222
public func makeAsyncIterator() -> AsyncIterator {
222223
AsyncIterator(storage: self._internalClass._storage)
223224
}
@@ -234,7 +235,8 @@ extension NIOThrowingAsyncSequenceProducer {
234235
@usableFromInline
235236
internal let _storage: Storage
236237

237-
fileprivate init(storage: Storage) {
238+
@inlinable
239+
init(storage: Storage) {
238240
self._storage = storage
239241
self._storage.iteratorInitialized()
240242
}
@@ -253,7 +255,8 @@ extension NIOThrowingAsyncSequenceProducer {
253255
@usableFromInline
254256
internal let _internalClass: InternalClass
255257

256-
fileprivate init(storage: Storage) {
258+
@inlinable
259+
init(storage: Storage) {
257260
self._internalClass = InternalClass(storage: storage)
258261
}
259262

@@ -309,7 +312,7 @@ extension NIOThrowingAsyncSequenceProducer {
309312
self._internalClass._storage
310313
}
311314

312-
@usableFromInline
315+
@inlinable
313316
internal init(storage: Storage, finishOnDeinit: Bool) {
314317
self._internalClass = .init(storage: storage, finishOnDeinit: finishOnDeinit)
315318
}
@@ -422,7 +425,7 @@ extension NIOThrowingAsyncSequenceProducer {
422425
@usableFromInline
423426
internal let _state: NIOLockedValueBox<State>
424427

425-
@usableFromInline
428+
@inlinable
426429
internal func _setDidSuspend(_ didSuspend: (@Sendable () -> Void)?) {
427430
self._state.withLockedValue {
428431
$0.didSuspend = didSuspend
@@ -434,7 +437,7 @@ extension NIOThrowingAsyncSequenceProducer {
434437
self._state.withLockedValue { $0.stateMachine.isFinished }
435438
}
436439

437-
@usableFromInline
440+
@inlinable
438441
internal init(
439442
backPressureStrategy: Strategy,
440443
delegate: Delegate
@@ -928,7 +931,7 @@ extension NIOThrowingAsyncSequenceProducer {
928931
/// Indicates that the yielded elements have been dropped.
929932
case returnDropped
930933

931-
@usableFromInline
934+
@inlinable
932935
init(
933936
shouldProduceMore: Bool,
934937
continuationAndElement: (CheckedContinuation<Element?, Error>, Element)? = nil

0 commit comments

Comments
 (0)