Mediator icon indicating copy to clipboard operation
Mediator copied to clipboard

Parallel notifications, correct ordering for switch statement cases

Open martinothamar opened this issue 2 months ago • 0 comments

Solves #115 and #138

  • INotificationPublisher abstraction similar to that of MediatR, apart from making the interface slightly worse while allowing better performance (avoiding closures, same as for the pipeline behavior interface)
  • Ordering of requests when building the compilation model now makes switch statements correct when there is inheritance and the base classes aren't abstract

TODO

  • Better naming?

Benchmarks


BenchmarkDotNet v0.13.12, Pop!_OS 22.04 LTS
AMD Ryzen 5 5600X, 1 CPU, 12 logical and 6 physical cores
.NET SDK 8.0.201
  [Host]     : .NET 8.0.2 (8.0.224.6711), X64 RyuJIT AVX2
  DefaultJob : .NET 8.0.2 (8.0.224.6711), X64 RyuJIT AVX2


Method ServiceLifetime Mean Error StdDev Ratio RatioSD Rank Gen0 Allocated Alloc Ratio
SendNotification_Baseline Singleton 0.0145 ns 0.0073 ns 0.0068 ns 1.00 0.00 1 - - NA
SendNotification_Mediator Singleton 11.1046 ns 0.0460 ns 0.0408 ns 1,016.06 668.32 2 - - NA
SendNotification_IMediator Singleton 20.3442 ns 0.0262 ns 0.0232 ns 1,860.85 1,223.14 3 - - NA
SendNotification_MessagePipe Singleton 31.7092 ns 0.0606 ns 0.0538 ns 2,902.13 1,909.50 4 0.0005 40 B NA
SendNotification_MediatR Singleton 100.1991 ns 0.2711 ns 0.2117 ns 8,401.17 5,794.82 5 0.0033 288 B NA

martinothamar avatar Mar 29 '24 20:03 martinothamar