Skip to content

TurboMediator v0.9.3

Latest

Choose a tag to compare

@MarcoCestari MarcoCestari released this 09 Mar 03:00

⚡ Performance

  • Source generator optimizations — 6-7x faster Send operations (e9964a5)
    • Pre-compiled handler wrapper classes with pipeline chain caching
    • DICache readonly struct for one-time DI resolution at construction
    • Monomorphized typed Send methods with AggressiveInlining
    • Generic Send methods with switch dispatch + Unsafe.As (zero boxing)
    • Typed Publish methods with switch dispatch for known notification types
    • Fast path bypass when no pipeline behaviors/processors registered
    • Deduplicated notification types in DICache and Publish methods
    • Benchmarks (before → after):
      Scenario Before After Speedup
      Command (void) 454ns / 168B 69ns / 24B 6.6x
      Command+Response 534ns / 192B 78ns / 48B 6.8x
      Query 514ns / 184B 74ns / 48B 7.0x
      Notification 227ns / 56B 108ns / 56B 2.1x
      Pipeline 617ns / 328B 317ns / 256B 1.9x

💥 Breaking Changes

  • Pre-built pipeline chains + array-based notification publishers (e22ac4c)
    1. MessageHandlerDelegate<TResponse>()MessageHandlerDelegate<TMessage, TResponse>(TMessage, CancellationToken)
      • Enables pre-compiled pipeline chains at DI construction time
      • Zero per-request closure allocations for pipeline behaviors
      • All IPipelineBehavior implementations must update signature
    2. INotificationPublisher: IEnumerable<INotificationHandler<T>>INotificationHandler<T>[]
      • Eliminates enumerable overhead in notification publishing
      • Custom publishers must accept array parameter
    • Benchmarks (after previous optimizations → after this change):
      Scenario Before After Improvement
      Pipeline 316ns / 256B 103ns / 48B 3x faster, 5x less memory
      Notification 108ns / 56B 110ns / 24B 2.3x less memory
    • TurboMediator now matches martinothamar/Mediator on Pipeline (103ns vs 94ns) and allocations (48B = 48B) while remaining 4-5x faster than MediatR
    • Updated: 23 behaviors, 5 publishers, source generator, testing base, 4 doc files, 3 samples, 21 test files, benchmark handler

🔧 Refactoring

  • Normalize EF packages — consistent naming, generic TContext pattern (32d361b)
    • Rename TurboMediator.Persistence.EFTurboMediator.Persistence.EntityFramework
    • Refactor all EF stores (Persistence, Scheduling) to generic TContext pattern instead of depending on abstract DbContext or package-owned DbContext
    • Add IEntityTypeConfiguration classes + ModelBuilderExtensions for all EF packages
    • Add EfCorePersistenceOptions / EfCoreSchedulingStoreOptions for table/schema configuration
    • Remove SchedulingDbContext (replaced by generic TContext + ApplySchedulingConfiguration)
    • Remove AddScoped<DbContext> alias requirement from samples
    • Standardize all 4 EF .csproj files: GenerateDocumentationFile=true
    • Update all tests, samples, docs, CI workflow, and solution file references

🏗️ Chores

  • Standardize LangVersion=latest and ImplicitUsings=enable across all projects (4bcce80)
    • Update all 27 .csproj files
    • Remove 148+ redundant explicit using statements now covered by implicit usings
    • Remove duplicate SchedulingDbContext.cs

✨ Features

  • Benchmark project comparing TurboMediator vs MediatR vs martinothamar/Mediator (31a5eb9)
    • 4 projects: Shared, TurboHandlers, SourceGenHandlers, Benchmarks runner
    • 5 benchmark scenarios: Command, Command+Response, Query, Notification, Pipeline
    • BenchmarkDotNet with MemoryDiagnoser

📖 Documentation

  • Add vibecoded page and fix optional packages list (d1766b8)
  • Add boilerplate problem section to why.mdx (7c88e27)