GithubHelp home page GithubHelp logo

lawrence-laz / generic-pipeline Goto Github PK

View Code? Open in Web Editor NEW
6.0 4.0 0.0 182 KB

A simple, fast and generic implementation of the pipeline design pattern.

License: MIT License

C# 99.80% Shell 0.20%
dotnet pipeline middleware aspect-oriented-programming mediator nuget-package

generic-pipeline's Introduction

NuGet Version NuGet Downloads Build Codacy Badge Codacy Badge

GenericPipeline

A general purpose dependency free pipeline builder. https://en.wikipedia.org/wiki/Pipeline_(software)

๐ŸŒŸ Features

  • Simplicity: Designed with simplicity in mind, the library offers a straightforward and easy-to-use pipeline implementation.
  • High Performance: The library boasts exceptional performance, as demonstrated by its benchmark results.
  • No Dispatch-Time Allocations: With the exception of async Task, the library makes no dispatch-time allocations, thus providing a highly efficient pipeline implementation.
  • No Dependencies: The library has zero external dependencies, making it lightweight and easy to integrate with other projects.

๐Ÿ“ฆ๏ธ Get started

Download from nuget.org:

dotnet add package GenericPipeline

โš–๏ธ Feature parity

GenericPipeline MediatR MessagePipe PipelineNet Mediator
Usable without dependency injection โœ”๏ธ โŒ โŒ โœ”๏ธ โŒ
Usable with dependency injection โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธยน โœ”๏ธ
.NET framework support โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ โŒ
Allocation-free dispatching โœ”๏ธ โŒ โœ”๏ธ โŒ โœ”๏ธ
Generic request handling โœ”๏ธ โœ”๏ธ โœ”๏ธ โŒ โœ”๏ธ
Async and sync handlers/behaviors โœ”๏ธ โŒ โœ”๏ธ โœ”๏ธ โŒ
Change handlers at runtime โœ”๏ธ โŒ โŒ โœ”๏ธยฒ โŒ
Behaviors โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ
Streams โŒ โœ”๏ธ โŒ โŒ โœ”๏ธ
Notifications โŒ โœ”๏ธ โœ”๏ธ โŒ โœ”๏ธ

ยน - Unity container only, ยฒ - add only, cannot remove

โšก๏ธ Benchmarks

Overhead per invocation for each library. Scenario contains a call to a behavior and a handler.

Sync:

Method Mean Allocated
Simple method call 5.7 ns -
GenericPipeline 31.2 ns -
MediatR 502.8 ns 600 B
PipelineNet 95.4 ns 152 B

Awaited async:

Method Mean Allocated
Simple method call 4 863 ns 560 B
GenericPipeline 5 906 ns 864 B
MediatR 6 662 ns 1160 B
PipelineNet 7 017 ns 1184 B
Pipe icons created by Smashicons - Flaticon

generic-pipeline's People

Contributors

lawrence-laz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

generic-pipeline's Issues

Add FAQ section to `readme.md`

Answer questions like:
- Should I use this instead of MediatR and alike?
- Can this be used for implementing CQRS?
- When should I use this?
- Why do I have to specify type parameters on send?
- How sync/async can be used together and when?

Add pipeline interfaces

  • This will allow mocking for unit tests.
  • Check if performance is not impacted, Mediator library for example always allocates memory when dispatching requests via an interface.

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.