A high-performance compiler for C# Expression Trees and a lightweight alternative to System.Linq.Expressions.
FastExpressionCompiler is a high-performance library for compiling C# Expression Trees, offering a significant speed boost over the standard `Expression.Compile()` method. It solves the problem of slow expression compilation in scenarios like IoC containers, serializers, and ORMs by emitting optimized IL with lower memory overhead. The library also includes a lightweight expression tree implementation for faster construction and reduced validation.
.NET developers working with expression trees in performance-sensitive applications, such as IoC/DI containers, serializers, ORMs, or mocking frameworks. It's particularly useful for those who need to compile expressions frequently and want to reduce compilation time and memory usage.
Developers choose FastExpressionCompiler for its 10-40x faster compilation speed, lower memory allocation, and lightweight expression tree alternative. It provides a drop-in replacement for System.Linq.Expressions with minimal changes, making it easy to integrate into existing projects while offering powerful diagnostic and code generation tools.
Fast Compiler for C# Expression Trees and the lightweight LightExpression alternative. Diagnostic and code generation tools for the expressions.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
CompileFast() is 10-40x faster than Expression.Compile() with lower memory allocation, as shown in benchmarks for hoisted expressions with closures and nested lambdas.
LightExpression offers a drop-in replacement for System.Linq.Expressions with faster creation and reduced memory overhead, though it sacrifices validation for speed.
Includes ToCSharpString() and ToExpressionString() for generating compilable C# code and expression construction code, plus debug info with CompilerFlags.EnableDelegateDebugInfo.
Uses a two-pass traversal to collect constants and nested lambdas, then emits optimized IL via DynamicMethod, reducing runtime overhead compared to standard compilation.
Does not support several expression nodes like Quote, Dynamic, and MemberInit with certain bindings, which can limit use in advanced scenarios or require fallbacks to Expression.Compile().
LightExpression skips the compatibility checks performed by System.Linq.Expressions, potentially leading to undetected errors in expression composition if not manually verified.
Adds an external library dependency that may introduce breaking changes or compatibility issues with future .NET updates, unlike the stable System.Linq.Expressions.