Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/timcassell/protopromise
Robust and efficient library for management of asynchronous operations in C#/.Net.
https://github.com/timcassell/protopromise
async async-await await callback callbacks concurrency concurrent coroutine coroutines csharp dotnet future futures parallel promise promises task tasks unity
Last synced: 2 days ago
JSON representation
Robust and efficient library for management of asynchronous operations in C#/.Net.
- Host: GitHub
- URL: https://github.com/timcassell/protopromise
- Owner: timcassell
- License: mit
- Created: 2019-12-08T01:08:13.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2024-10-29T07:46:08.000Z (3 months ago)
- Last Synced: 2024-10-29T10:12:28.184Z (3 months ago)
- Topics: async, async-await, await, callback, callbacks, concurrency, concurrent, coroutine, coroutines, csharp, dotnet, future, futures, parallel, promise, promises, task, tasks, unity
- Language: C#
- Homepage:
- Size: 8.96 MB
- Stars: 153
- Watchers: 4
- Forks: 13
- Open Issues: 8
-
Metadata Files:
- Readme: .github/README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# ProtoPromise
Robust and efficient library for management of asynchronous operations.
- Allocation-free async operations
- Cancelable operations with custom allocation-free CancelationToken/Source
- Allocation-free async iterators with async Linq
- Progress with enforced normalization
- Structured concurrency
- async/await support and .Then API
- Thread safe
- Easily switch to foreground or background context
- Circular await detection
- Full causality traces
- Interoperable with Tasks and Unity's Coroutines/Awaitables
- CLS compliantProtoPromise conforms to the [Promises/A+ Spec](https://promisesaplus.com/) as far as is possible with C# (using static typing instead of dynamic), and further extends it to support Cancelations and Progress.
This library was built to work in all C#/.Net ecosystems, including Unity, Mono, .Net Framework, .Net Core, and AOT compilation. It is CLS compliant, so it is not restricted to only C#, and will work with any .Net language.
- ProtoPromise v3 supports .Net Standard 2.0 or newer (Unity 2018.3 or newer).
- ProtoPromise v2 supports .Net 3.5 or newer (Unity 5.5 or newer).See [Guides](https://github.com/timcassell/ProtoPromise/tree/master/Docs/Guides) for information on how to install and use this library.
Compare performance to other async libraries:
| Type | Pending | Mean | Allocated | Survived |
|------------- |-------- |-----------:|----------:|---------:|
| ProtoPromise | False | 172.6 ns | - | - |
| Task | False | 260.9 ns | 192 B | - |
| UniTask | False | 306.8 ns | - | - |
| UnityFxAsync | False | 368.6 ns | 360 B | - |
| ValueTask | False | 337.4 ns | - | - |
| | | | | |
| ProtoPromise | True | 1,402.3 ns | - | 648 B |
| Task | True | 2,110.8 ns | 1120 B | - |
| UniTask | True | 1,817.7 ns | - | 744 B |
| UnityFxAsync | True | 1,998.2 ns | 1952 B | - |
| ValueTask | True | 2,486.9 ns | 968 B | 40 B |See the [C# Asynchronous Benchmarks Repo](https://github.com/timcassell/CSharpAsynchronousBenchmarks) for a full performance comparison.
## Latest Updates
### v3.2.0 - November 3, 2024
- Added Channels.
- Added `Promise().{ConfigureAwait, ConfigureContinuation}` APIs.
- Added `SynchronizationOption.CapturedContext` option.See [ChangeLog](https://github.com/timcassell/ProtoPromise/tree/master/Docs/Changelog) for the full changelog.
## Acknowledgements
This library was inspired by [ES6 Promises](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise), [RSG Promises](https://github.com/Real-Serious-Games/C-Sharp-Promise), [uPromise](https://assetstore.unity.com/packages/tools/upromise-15604), [TPL](https://docs.microsoft.com/en-us/dotnet/standard/parallel-programming/task-parallel-library-tpl), [UniTask](https://github.com/Cysharp/UniTask), [AsyncEx](https://github.com/StephenCleary/AsyncEx), and [UnityAsync](https://github.com/muckSponge/UnityAsync).