Optimization for immediate operations in empty queues
- Dominant language
- Swift
- Stars
- 43
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
For example, can we avoid a hop when the queue is empty and the operation is synchronous?
```swift
let queue = AsyncQueue()
await queue.perform { print("Hello") }
// <- Here "Hello" would be printed already.
```
Similarly, could we add support for immediate tasks ([SE-0472](https://github.com/swiftlang/swift-evolution/blob/main/proposals/0472-task-start-synchronously-on-caller-context.md))?
```swift
let queue = AsyncQueue()
await queue.performImmediately { ... }
queue.addImmediateTask { ... }
```
The latter APIs are problematic, though, because the operation won't start immediately if the queue is not empty.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.