Based on MediatR.
Three times faster than MediatR. Infrastructure should not slow down.
Method | Mean | Error | StdDev | Ratio | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|
MediatR | 86.66 μs | 0.462 μs | 0.386 μs | 1.00 | 12.2070 | - | - | 75.31 KB |
Marble | 21.17 μs | 0.068 μs | 0.053 μs | 0.24 | 1.4038 | - | - | 8.74 KB |
Method | Mean | Error | StdDev | Ratio | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|
MediatR | 11.893 us | 0.1340 us | 0.1253 us | 1.00 | 2.3346 | - | - | 14.37 KB |
Marble | 1.702 us | 0.0085 us | 0.0075 us | 0.14 | 0.1640 | - | - | 1.01 KB |
Method | Mean | Error | StdDev | Ratio | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|
MediatR | 6.778 us | 0.1116 us | 0.1044 us | 1.00 | 1.1292 | - | - | 7112 B |
Marble | 4.262 us | 0.0298 us | 0.0264 us | 0.63 | 0.1068 | - | - | 712 B |
Method | Mean | Error | StdDev | Ratio | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|
MediatR | 3.249 us | 0.0342 us | 0.0320 us | 1.00 | 0.5569 | - | - | 3512 B |
Marble | 1.574 us | 0.0141 us | 0.0117 us | 0.48 | 0.0114 | - | - | 72 B |
Install Marble with the following command from nuget:
Install-Package Marble
Scans assemblies to add handlers, preprocessors, behaviours and postprocessors implementations to the container.
To use, with an IServiceCollection
instance:
services.AddMediator(typeof(MyHandler).Assembly)
services.AddMediator(typeof(MyHandler), typeof(MyPreProcessor), typeof(YourHandler))
services.AddMediator(options => options.RegisterRequest<MyRequest>())