You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+14-14Lines changed: 14 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -294,26 +294,26 @@ We chose `IDispatcher` and `Dispatcher` because the name honestly describes the
294
294
295
295
There are many great request dispatcher / "mediator" implementations out there. Here is a comparison between ResultR and some of the other popular ones:
296
296
297
-
Performance comparison between ResultR (latest), [MediatR](https://github.com/jbogard/MediatR) (12.5.0), [DispatchR](https://github.com/hasanxdev/DispatchR) (2.1.1), and [Mediator.SourceGenerator](https://github.com/martinothamar/Mediator) (2.1.7):
297
+
Performance comparison between ResultR (latest), [MediatR](https://github.com/jbogard/MediatR) (12.5.0), [DispatchR](https://github.com/hasanxdev/DispatchR) (2.1.1), and [Mediator.SourceGenerator](https://github.com/martinothamar/Mediator) (3.0.1):
| MediatorSG - With Validation |20.26 ns | 72 B | 0.27|
302
-
| MediatorSG - Simple |23.01 ns | 72 B | 0.31 |
303
-
| DispatchR - With Validation |31.37 ns | 96 B | 0.42|
304
-
| DispatchR - Simple |34.93 ns | 96 B | 0.47|
305
-
|DispatchR - Full Pipeline | 44.02 ns |96 B | 0.59|
306
-
|MediatorSG - Full Pipeline |44.35 ns |72 B | 0.59|
307
-
|ResultR - Full Pipeline|62.92 ns |264 B |0.84|
308
-
|MediatR - Simple |75.03 ns |296 B | 1.00|
309
-
| ResultR - With Validation |77.10 ns | 264 B | 1.03|
310
-
| ResultR - Simple |95.42 ns | 264 B | 1.27|
311
-
| MediatR - With Validation |120.28 ns | 608 B |1.60|
312
-
| MediatR - Full Pipeline |158.01 ns | 824 B | 2.11|
301
+
| MediatorSG - Simple |17.15 ns | 72 B | 0.25|
302
+
| MediatorSG - With Validation |21.46 ns | 72 B | 0.31 |
303
+
| DispatchR - With Validation |38.51 ns | 96 B | 0.56|
304
+
| DispatchR - Simple |39.33 ns | 96 B | 0.58|
305
+
|MediatorSG - Full Pipeline | 44.27 ns |72 B | 0.65|
306
+
|DispatchR - Full Pipeline |65.27 ns |96 B | 0.96|
307
+
|MediatR - Simple |68.23 ns |296 B |1.00|
308
+
|ResultR - Full Pipeline|73.34 ns |264 B | 1.08|
309
+
| ResultR - With Validation |75.46 ns | 264 B | 1.11|
310
+
| ResultR - Simple |80.65 ns | 264 B | 1.18|
311
+
| MediatR - With Validation |139.48 ns | 608 B |2.05|
312
+
| MediatR - Full Pipeline |169.90 ns | 824 B | 2.49|
313
313
314
314
> **Note on benchmark methodology:** All libraries are configured with equivalent pipeline behaviors (validation, pre/post processing) for fair comparison. MediatorSG and DispatchR use source generation for optimal performance. ResultR always executes its full pipeline (Validate → BeforeHandle → Handle → AfterHandle) even when hooks use default implementations, which explains why "Simple" is slower than "Full Pipeline" - they're doing the same work.
315
315
316
-
> **What does this mean?** When comparing equivalent functionality (full pipeline with behaviors), ResultR (63ns) significantly outperforms MediatR (158ns) - over 2.5x faster. The source-generated libraries (MediatorSG, DispatchR) are fastest but require compile-time code generation. In real applications where database queries take 1-10ms and HTTP calls take 50-500ms, these nanosecond differences are negligible. ResultR also allocates less memory than MediatR (264B vs 296-824B), reducing GC pressure in high-throughput scenarios.
316
+
> **What does this mean?** When comparing equivalent functionality (full pipeline with behaviors), ResultR (73ns) significantly outperforms MediatR (170ns) - over 2.3x faster. The source-generated libraries (MediatorSG, DispatchR) are fastest but require compile-time code generation. In real applications where database queries take 1-10ms and HTTP calls take 50-500ms, these nanosecond differences are negligible. ResultR also allocates less memory than MediatR (264B vs 296-824B), reducing GC pressure in high-throughput scenarios.
0 commit comments