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 customization point for enqueue #190

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

FranzBusch
Copy link
Member

Motivation

The default implementation of SerialExecutor for EventLoops causes a lot of allocations that's why we added a new customization point to allow EventLoops to implement fast paths.

Modification

This PR adds the customization point to NIOTSEventLoop.

# Motivation
The default implementation of `SerialExecutor` for `EventLoop`s causes a lot of allocations that's why we added a new customization point to allow `EventLoop`s to implement fast paths.

# Modification
This PR adds the customization point to `NIOTSEventLoop`.
extension NIOTSEventLoop: NIOSerialEventLoopExecutor {
func enqueue(_ job: consuming ExecutorJob) {
let unownedJob = UnownedJob(job)
if let executorQueue = self.taskQueue as? _DispatchSerialExecutorQueue {
Copy link
Member Author

Choose a reason for hiding this comment

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

This is currently just available as underscored API and cannot be relied on. This PR is more for demonstrating that this can be fast pathed as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant