Skip to content

Sannr vs Others ​

Sannr was built to replace System.ComponentModel.DataAnnotations (and popular third-party alternatives like FluentValidation) in modern cloud-native .NET applications.

Performance Comparison ​

Standard validation libraries rely heavily on runtime Reflection. This implies continuous latency, boxed objects, and high GC pressure.

Sannr generates highly optimized static code that behaves exactly like hand-written logic.

FeatureSystem.ComponentModel.DataAnnotationsFluentValidationSannr
Runtime MechanismReflection (Slow)Expression Trees/ReflectionStatic C# (Instant)
Native AOTRequires warnings/trimmingCustom interceptors needed** 100% Trimming Safe**
Async SupportSynchronous OnlySupported** Native Task<T>**
Dependency InjectionService Locator Anti-PatternVia Object Factory** IServiceProvider Support**
SanitizationManual code in ControllersManual/Complex hooks** [Sanitize] Built-in**

Benchmarks ​

Validation runs in microseconds. See for yourself.

ScenarioDataAnnotationsFluentValidationSannrDifference
Speed (Simple)2,802.4 ns1,371.3 ns207.8 ns13.5x faster
Speed (Complex)12,156.7 ns5,682.9 ns623.5 ns20x faster
Memory (Complex)8,192 B1,208 B392 B95% less RAM

Released under the MIT License.