basically I created "two paths" for the CE to use Bind/ReturnFrom/BindReturn on. The "value" path and the "function" path. Value path only takes 'Awaiter/TaskAwaiter while function takes CancellationToken -> 'Awaiter/TaskAwaiter . Previously I was using Source members to move Awaiter/TaskAwaiter to a CancellationToken -> 'Awaiter/TaskAwaiter but this was causing overhead. Means I have to implement a second Bind/ReturnFrom/BindReturn to make that work though
Optimizes getCancellationToken
Can don't have to construct a whole builder to get it.
Optimizes the Task/Awaiter path
Shown in the table below you can see the allocation was extremely high for binding to tasks directly.
What types of changes does your code introduce to IcedTasks?
Put an x in the boxes that apply
[ ] Bugfix (non-breaking change which fixes an issue)
[ ] New feature (non-breaking change which adds functionality)
[ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
Checklist
Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.
[ ] Build and tests pass locally
[ ] I have added tests that prove my fix is effective or that my feature works (if appropriate)
[ ] I have added necessary documentation (if appropriate)
Further comments
If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...
Proposed Changes
Task/Awaiter
pathBind/ReturnFrom/BindReturn
on. The "value" path and the "function" path. Value path only takes'Awaiter/TaskAwaiter
while function takesCancellationToken -> 'Awaiter/TaskAwaiter
. Previously I was using Source members to moveAwaiter/TaskAwaiter
to aCancellationToken -> 'Awaiter/TaskAwaiter
but this was causing overhead. Means I have to implement a secondBind/ReturnFrom/BindReturn
to make that work thoughgetCancellationToken
Optimizes the
Task/Awaiter
pathShown in the table below you can see the allocation was extremely high for binding to tasks directly.
After this change the allocations are the same as binding against
CancellationToken -> Task<'T>
Optimizes
getCancellationToken
Similarly I was able to optimize allocations on
getCancellationToken
Types of changes
What types of changes does your code introduce to IcedTasks? Put an
x
in the boxes that applyChecklist
Put an
x
in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.Further comments
If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...