-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Concurrency] Reduce overhead of Task.yield and Task.sleep #37090
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
Conversation
@swift-ci smoke test |
712d674
to
6291698
Compare
@swift-ci smoke test |
@swift-ci smoke test windows |
@swift-ci smoke test macos |
@swift-ci smoke test windows |
6291698
to
8212492
Compare
@swift-ci smoke test |
8212492
to
3f9a58e
Compare
@swift-ci smoke test |
@swift-ci smoke test macos |
1 similar comment
@swift-ci smoke test macos |
Instead of creating a new task, we create a simple job that wraps a Builtin.RawUnsafeContinuation and resumes the continuation when it is executed. The job instance is allocated on the task local allocator, meaning we don't malloc anything.
3f9a58e
to
ed00146
Compare
@swift-ci smoke test |
@swift-ci smoke test windows |
@swift-ci smoke test macos |
continuation); | ||
|
||
return job; | ||
} |
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.
👍
return await Builtin.withUnsafeContinuation { (continuation: Builtin.RawUnsafeContinuation) -> Void in | ||
let job = _taskCreateNullaryContinuationJob(priority: priority.rawValue, continuation: continuation) | ||
_enqueueJobGlobal(job) | ||
} |
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.
nice 👍
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.
This looks all good to me!
I think you can adjust the @available
and merge @drexin, this should be low risk IMO.
Co-authored-by: Konrad `ktoso` Malawski <[email protected]>
@swift-ci smoke test |
@swift-ci smoke test windows |
1 similar comment
@swift-ci smoke test windows |
Windows failure is unrelated. |
…#37090) * [Concurrency] Reduce overhead of Task.yield and Task.sleep Instead of creating a new task, we create a simple job that wraps a Builtin.RawUnsafeContinuation and resumes the continuation when it is executed. The job instance is allocated on the task local allocator, meaning we don't malloc anything. * Update stdlib/public/Concurrency/Task.swift Co-authored-by: Konrad `ktoso` Malawski <[email protected]> Co-authored-by: Konrad `ktoso` Malawski <[email protected]>
…37345) * [Concurrency] Reduce overhead of Task.yield and Task.sleep Instead of creating a new task, we create a simple job that wraps a Builtin.RawUnsafeContinuation and resumes the continuation when it is executed. The job instance is allocated on the task local allocator, meaning we don't malloc anything. * Update stdlib/public/Concurrency/Task.swift Co-authored-by: Konrad `ktoso` Malawski <[email protected]> Co-authored-by: Konrad `ktoso` Malawski <[email protected]> Co-authored-by: Konrad `ktoso` Malawski <[email protected]>
Instead of creating a new task, we create a simple job that wraps a Builtin.RawUnsafeContinuation and resumes the continuation when it is executed. The job instance is allocated on the task local allocator, meaning we don't malloc anything.