What types of changes does your code introduce to IcedTasks?
Put an x in the boxes that apply
[x] New feature (non-breaking change which adds functionality)
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.
[x] Build and tests pass locally
[x] I have added tests that prove my fix is effective or that my feature works (if appropriate)
[x] I have added necessary documentation (if appropriate)
Further comments
I implemented both Async.StartChild and Async.StartImmediateAsTask as described by The BDFN Himself to get a better idea of performance differences between them. I did 3 types of tests:
NonAsyncBinds - These will return synchronously and not yield
AsyncBinds - These will return asynchronously and yield
AsyncBindsLong Same as AsyncBinds but shows that parallel and! can be beneficial on slower computations.
Additionally I added an applicative_overhead to compare 10 let! vs 10 let! ...and!... and! ... to see what the overhead is.
| Method | Categories | Mean | Error | StdDev | Median | Gen 0 | Gen 1 | Gen 2 | Allocated |
|--------------------------------------------------------- |--------------- |--------------:|------------:|------------:|--------------:|----------:|---------:|---------:|----------:|
| AsyncBuilder_sync | NonAsyncBinds | 8.249 ms | 0.1610 ms | 0.2410 ms | 8.248 ms | 296.8750 | - | - | 2,484 KB |
| AsyncBuilder_sync_applicative_overhead | NonAsyncBinds | 8.886 ms | 0.1761 ms | 0.1729 ms | 8.879 ms | 515.6250 | - | - | 4,320 KB |
| ParallelAsyncBuilderUsingStartChild_sync | NonAsyncBinds | 50.430 ms | 2.8994 ms | 8.5490 ms | 45.826 ms | 4222.2222 | 111.1111 | - | 34,313 KB |
| ParallelAsyncBuilderUsingStartImmediateAsTask_sync | NonAsyncBinds | 15.428 ms | 0.1229 ms | 0.1150 ms | 15.383 ms | 2000.0000 | - | - | 16,484 KB |
| | | | | | | | | | |
| AsyncBuilder_async | AsyncBinds | 74.702 ms | 1.1459 ms | 1.0158 ms | 74.756 ms | 1000.0000 | - | - | 8,377 KB |
| AsyncBuilder_async_applicative_overhead | AsyncBinds | 76.906 ms | 1.1282 ms | 1.2072 ms | 76.635 ms | 1285.7143 | - | - | 10,555 KB |
| ParallelAsyncBuilderUsingStartChild_async | AsyncBinds | 72.837 ms | 0.9044 ms | 0.8460 ms | 72.646 ms | 5250.0000 | 875.0000 | 125.0000 | 43,321 KB |
| ParallelAsyncBuilderUsingStartImmediateAsTask_async | AsyncBinds | 67.787 ms | 1.3305 ms | 1.6826 ms | 68.050 ms | 3125.0000 | - | - | 26,114 KB |
| | | | | | | | | | |
| AsyncBuilder_async_long | AsyncBindsLong | 11,449.167 ms | 79.4426 ms | 62.0235 ms | 11,438.866 ms | - | - | - | 839 KB |
| AsyncBuilder_async_long_applicative_overhead | AsyncBindsLong | 11,930.969 ms | 224.8506 ms | 322.4739 ms | 12,062.812 ms | - | - | - | 1,057 KB |
| ParallelAsyncBuilderUsingStartChild_async_long | AsyncBindsLong | 1,221.578 ms | 24.3126 ms | 28.9425 ms | 1,218.303 ms | - | - | - | 4,315 KB |
| ParallelAsyncBuilderUsingStartImmediateAsTask_async_long | AsyncBindsLong | 1,229.845 ms | 23.8712 ms | 31.0393 ms | 1,228.502 ms | - | - | - | 2,690 KB |
Take away is Async.StartImmediateAsTask seems to out perform Async.StartChild which is probably due to Async.StartChild running the computation on the threadpool.
Proposed Changes
Closes #6
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
I implemented both
Async.StartChild
andAsync.StartImmediateAsTask
as described by The BDFN Himself to get a better idea of performance differences between them. I did 3 types of tests:NonAsyncBinds
- These will return synchronously and not yieldAsyncBinds
- These will return asynchronously and yieldAsyncBindsLong
Same asAsyncBinds
but shows that paralleland!
can be beneficial on slower computations.Additionally I added an
applicative_overhead
to compare 10let!
vs 10let! ...and!... and! ...
to see what the overhead is.Take away is
Async.StartImmediateAsTask
seems to out performAsync.StartChild
which is probably due toAsync.StartChild
running the computation on the threadpool.