timcassell / ProtoPromise

Robust and efficient library for management of asynchronous operations in C#/.Net.
MIT License
136 stars 13 forks source link
async async-await await callback callbacks concurrency concurrent coroutine coroutines csharp dotnet future futures parallel promise promises task tasks unity

ProtoPromise

<img src="https://promisesaplus.com/assets/logo-small.png" alt="Promises/A+ logo" title="Promises/A+ 1.1 compliant" align="right" />

Robust and efficient library for management of asynchronous operations.

ProtoPromise conforms to the Promises/A+ Spec 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.

See 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 for a full performance comparison.

Latest Updates

v3.1.0 - June 30, 2024

See ChangeLog for the full changelog.

Acknowledgements

This library was inspired by ES6 Promises, RSG Promises, uPromise, TPL, UniTask, AsyncEx, and UnityAsync.