A general purpose dependency free pipeline builder. https://en.wikipedia.org/wiki/Pipeline_(software)
Task
, the library makes no dispatch-time allocations, thus providing a highly efficient pipeline implementation.Download from nuget.org:
dotnet add package GenericPipeline
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
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 |