Skip to content
bitzorcas
中EN

Concept

Source Generator & Native AOT: Zero-Reflection Compilation

Explore compile-time code generation in BitzOrcas.Modern: Minimal API EndpointGenerator, dual-ORM FluentMappingGenerator, and Native AOT sub-50ms cold starts.

Last updated

In cloud-native containers, runtime reflection causes slow cold starts, heavy memory footprints, and AOT trimming incompatibilities. BitzOrcas.Modern enforces “Source Generator First”: all metadata resolution occurs during compilation via Roslyn incremental generators.

Roslyn Incremental Generation Flow

Core Roslyn Source Generators

1. EndpointGenerator (Minimal API Endpoints)

2. FluentMappingGenerator (EF Core & SqlSugar Mappings)

3. JsonContextGenerator (System.Text.Json AOT Context)

C# Attributes ([GenerateEndpoint], [BitzTable], [BitzColumn])

Roslyn Pipeline (IIncrementalGenerator)

Compile-Time Generated C# Code (.g.cs)

.NET 10 Native AOT Binary (Zero Reflection)


Native AOT Performance Benchmarks

MetricTraditional MonolithBitzOrcas Native AOTImprovement
Cold Start1800ms ~ 3500ms< 45ms50x Faster
Base RSS Memory220MB ~ 450MB< 38MB85% Reduction
Image Size280MB< 45MB80% Smaller
P99 Latency15ms< 1.8msZero JIT Jitter

Summary

Roslyn generators and Native AOT empower BitzOrcas.Modern with ultra-low latency, tiny container footprints, and cloud-native elasticity.

100%

Scroll or use controls to zoom · drag when enlarged · double-click for 100% / 200%