Hyperbee Expression Compiler

Hyperbee.Expressions.Compiler is a high-performance, IR-based compiler for .NET expression trees. It is a drop-in replacement for Expression.Compile() that emits IL directly, bypassing the System expression interpreter.


Installation

dotnet add package Hyperbee.Expressions.Compiler

Quick Start

using Hyperbee.Expressions.Compiler;

// Direct replacement for lambda.Compile()
var fn = HyperbeeCompiler.Compile( lambda );

// Or use the IExpressionCompiler interface for DI
services.AddSingleton<IExpressionCompiler>( HyperbeeExpressionCompiler.Instance );

Topics

Topic Description
Overview Architecture, compilation pipeline, optimization passes
API Reference HyperbeeCompiler, HyperbeeExpressionCompiler, CompileToMethod
Diagnostics IR capture, CompilerDiagnostics, IRFormatter
Performance Benchmarks vs System compiler and FastExpressionCompiler

Highlights

  • 9.3-48x faster compilation than the System compiler
  • 1.15-1.53x of FastExpressionCompiler (FEC) compilation time
  • 29-57% fewer allocations than the System compiler
  • 16-24x faster coroutine execution than the System compiler; FEC does not support coroutines
  • Supports all expression patterns – including those FEC does not support
  • Fully compatible with AsyncBlockExpression state machines via ambient context
  • IExpressionCompiler interface for DI-friendly injection

Coroutines here means BlockAsync and BlockEnumerable, the async/await and yield-return expression tree nodes from Hyperbee.Expressions, a separate package. The compiler needs only Hyperbee.Expressions.Abstractions; add that package if you want the nodes themselves.


© Stillpoint Software.

Hyperbee Expression Compiler Docs