Giter VIP home page Giter VIP logo

protopromise's Introduction

ProtoPromise

Promises/A+ logo

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
  • async/await support and .Then API
  • Thread safe
  • Full causality traces
  • Easily switch to foreground or background context
  • Combine async operations
  • Circular await detection
  • Interoperable with Tasks and Unity's Coroutines/Awaitables
  • CLS compliant

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.

  • 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 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.0.2 - April 12, 2024

  • Fixed Promise.ParallelFor* canceling workers too early.
  • Promise.ParallelFor* and AsyncEnumerable.Merge propagate exceptions from cancelation token callbacks instead of deadlocking.
  • AsyncEnumerable.Merge more eagerly stops iteration if a rejection or cancelation occurs.

See ChangeLog for the full changelog.

Acknowledgements

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.