lawrence-laz / generic-pipeline

A simple, fast and generic implementation of the pipeline design pattern.
MIT License
6 stars 0 forks source link
aspect-oriented-programming dotnet mediator middleware nuget-package pipeline

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

๐Ÿ“ฆ๏ธ 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