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

Optimize PromiseYieldExtensions.AwaitInstructionAwaiter #466

Open
timcassell opened this issue Aug 15, 2024 · 1 comment
Open

Optimize PromiseYieldExtensions.AwaitInstructionAwaiter #466

timcassell opened this issue Aug 15, 2024 · 1 comment
Milestone

Comments

@timcassell
Copy link
Owner

PromiseYieldExtensions.GetAwaiter<TAwaitInstruction>(this TAwaitInstruction awaitInstruction) returns AwaitInstructionAwaiter<TAwaitInstruction> which needlessly queries the CancelationToken.IsCancelationRequested even when the user hasn't called .WithCancelation. This can be optimized by splitting out the cancelation logic to a separate AwaitInstructionWithCancelationAwaiter<TAwaitInstruction>.

This will be a breaking change, so it should wait for the next major version.

@timcassell
Copy link
Owner Author

While we're at it, we can also move the private Action _continuation; field out of the awaiter, and put it in a separate type when it's added to the update processor, to reduce the size of async state machines.

@timcassell timcassell added this to the v4.0.0 milestone Jan 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant