groue / groue/AsyncQueues

Optimization for immediate operations in empty queues

Open
#5 0 comments 0 reactions 0 assignees View on GitHub
enhancement
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.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.