I took one small Minimal API, published it four ways and started each one cold 30 times. Native AOT reached "ready" about 2.1–2.3× sooner than JIT and used about a third of the peak memory. The difference between .NET 10 and .NET 11 was smaller than the noise.

⚠️ Measured locally in Docker on one laptop. This is not an AWS result. No cloud run was made.

Full code and scripts:

GitHub logo arbabazmi / dotnet11-web-samples

ASP.NET Core 11 sample projects: C# 15 unions, MCP + Blazor AI, Native AOT benchmark

.NET 11 Web Samples

Three small ASP.NET Core 11 projects that try what is new on the web side of .NET 11, and write down what worked, what surprised me and what did not. All data is synthetic. Everything here was built and run on .NET SDK 11.0.100.

# Project Folder What it shows
1 Fee calculator API src/FeeCalc.Api C# 15 union types, mapped to HTTP with exhaustive switch
2 MCP server + Blazor AI chat src/CommissionMcp.Server, src/CommissionMcp.Web An MCP server, and a chat page where a model calls its tools and a person approves any change
3 Native AOT benchmark src/Aot.Bench Cold start, memory and image size: JIT vs Native AOT on .NET 10 and .NET 11

Each project folder has its own README with the details, commands and findings. This page is the overview.

Prerequisites

Needed for Install
Everything .NET SDK 11.0.100 (pinned in global.json)
Project
…

The question

A .NET app normally starts on the JIT: the runtime loads, then compiles your code to machine code as it runs. Native AOT compiles everything ahead of time into one native executable, so there is no JIT work at startup. That should start faster and use less memory. The cost is a stricter set of rules (no unrestricted reflection) and a longer build.

.NET 11 is generally available, and its release notes list a Native AOT improvement: faster interface dispatch through a shared dispatch helper. This benchmark does not isolate that change. It asks the practical question instead: for the same API on .NET 10 and .NET 11, what does AOT change in startup time, memory and image size?

The design

Same source code, four publishes:

Four variants: .NET 10 and .NET 11, each published as JIT and Native AOT, with their Docker base images

Each variant is built inside the matching official SDK image (sdk:10.0 or sdk:11.0), so nothing depends on what is installed on the laptop. The app is a stripped-down fee calculator: plain records and source-generated JSON, with no C# 15 unions, because unions do not compile for net10.0.

Two stopwatches

Each cold run starts a fresh container, and two things are timed:

  1. docker run is called → First 200 stopwatch starts (in the benchmark script)
  2. The process starts → Ready stopwatch starts (read inside the app from the process start time)
  3. The server is listening → Ready stops (in the app's ApplicationStarted callback)
  4. /health first answers 200 → First 200 stops (script polls every 5 ms, so this includes container start-up)

The key code

1. One project, four publishes (Aot.Bench.csproj)

<BenchTfm Condition="'$(BenchTfm)' == ''">net11.0</BenchTfm> <TargetFramework>$(BenchTfm)</TargetFramework> <LangVersion>14</LangVersion> <!-- keeps the code buildable on net10.0 --> <JsonSerializerIsReflectionEnabledByDefault>false</JsonSerializerIsReflectionEnabledByDefault> <PropertyGroup Condition="'$(Aot)' == 'true'"> <PublishAot>true</PublishAot> <StripSymbols>true</StripSymbols> </PropertyGroup> 

The target framework comes from -p:BenchTfm=net10.0, and AOT is switched on with -p:Aot=true. With reflection-based JSON switched off, a type missing from the source-generated context fails at runtime on JIT as well, instead of only after the AOT publish.

2. The AOT-friendly API surface (Program.cs)

var builder = WebApplication.CreateSlimBuilder(args); builder.Services.ConfigureHttpJsonOptions(o => o.SerializerOptions.TypeInfoResolverChain.Insert(0, BenchJsonContext.Default)); [JsonSerializable(typeof(FeeRequest))] [JsonSerializable(typeof(FeeResult))] [JsonSerializable(typeof(RateCard))] [JsonSerializable(typeof(ErrorBody))] [JsonSerializable(typeof(Diag))] internal partial class BenchJsonContext : JsonSerializerContext; 

CreateSlimBuilder is the AOT-oriented entry point with fewer default features, and the JsonSerializerContext generates the JSON code at build time. With both in place, the AOT publish produced zero warnings.

3. Measuring "Ready" from inside the app

double readyMs = -1; app.Lifetime.ApplicationStarted.Register(() => readyMs = (DateTime.Now - Process.GetCurrentProcess().StartTime).TotalMilliseconds); 

A /diag endpoint returns this value, the runtime version, whether dynamic code is supported (true on JIT, false on AOT) and the peak working set.

4. Building AOT in Docker (bench/Dockerfile)

FROM mcr.microsoft.com/dotnet/sdk:${DOTNET} AS build-aot RUN apt-get update && apt-get install -y --no-install-recommends clang zlib1g-dev RUN dotnet publish -p:BenchTfm=${TFM} -c Release -p:Aot=true -o /out FROM mcr.microsoft.com/dotnet/runtime-deps:${DOTNET} AS aot COPY --from=build-aot /out /app ENTRYPOINT ["./Aot.Bench"] 

Native AOT needs a C++ toolchain to link, which is why the build stage installs clang. The final image needs only runtime-deps, because the AOT executable carries everything else.

The results

30 cold runs per variant for startup, then peak memory after 100 requests on a fresh container, and the image size from Docker.

Bar charts: Native AOT vs JIT startup time, peak memory and image size on .NET 10 and .NET 11

Variant Ready median (ms) Ready p95 (ms) First 200 median (ms) First 200 p95 (ms) Peak mem (MB) Image (MB)
A · net10 JIT 548.9 824.5 1,139.0 1,574.8 64.8 234.4
C · net11 JIT 534.9 614.2 1,084.3 1,270.2 66.9 246.2
B · net10 AOT 236.8 348.3 697.6 863.1 19.1 159.6
D · net11 AOT 249.1 366.1 767.3 884.2 20.2 174.4

On .NET 11, JIT → AOT:

  • ⚡ 2.1× faster to ready (535 → 249 ms)
  • 🌐 1.4× faster to first 200 (1,084 → 767 ms)
  • 🧠 3.3× less peak memory (66.9 → 20.2 MB)
  • 📦 −72 MB image (246 → 174 MB, −29%)

What the numbers say: Between .NET 10 and .NET 11 the startup gaps are 14 ms (JIT) and 12 ms (AOT), which is inside the run-to-run spread. The one consistent difference is that the .NET 11 images are 12–15 MB larger. These results do not show .NET 11 starting faster or slower than .NET 10.

What worked, what surprised me, what did not

✅ Worked

  • Source-generated JSON plus CreateSlimBuilder gave zero AOT warnings on both .NET 10 and .NET 11.
  • Building each variant in its own SDK image made the comparison independent of the laptop.
  • All four variants passed the same five smoke checks (health, two rate lookups, two calculations).

🤔 Surprised me

  • .NET 11 was not measurably faster than .NET 10 for this app, in either mode.
  • The AOT image is still 160–174 MB.
  • Each AOT build took about 70–77 seconds, with base images already pulled.

❌ Did not work

  • A project targeting both net10.0 and net11.0: the .NET 10 SDK refuses to restore it (NETSDK1045). One target, chosen by property, fixed it.
  • Publishing AOT on Windows: it needs the Visual Studio C++ tools, which were not installed. Docker avoided that.

The price of AOT is also in the code: the app cannot rely on unrestricted reflection, and dynamic code is not supported (/diag reports dynamicCode: false). I did not measure debugging cost or compatibility with other libraries, so I make no claim about them.

How far to trust these numbers

  • Local, not AWS. No cloud run was made, so this says nothing about Fargate or Lambda.
  • One laptop, no interleaving. A 12-thread Intel i7-1355U, Docker on WSL2. Variants ran one after another, so background activity could favour one of them.
  • The p95 of 30 runs is the second-slowest run. Treat it as an indication of spread, not a precise percentile.
  • The "Ready" clock is coarse. It reads the process start time, which has clock-tick resolution on Linux. "First 200" includes Docker's container start and a 5 ms polling interval, so compare variants with each other, not with other setups.
  • Build time is rough. JIT build times were distorted by Docker's layer cache, so only the AOT figures are quoted.

Run it yourself

Needs Docker running. Code is under src/Aot.Bench, scripts in bench/.

git clone https://github.com/arbabazmi/dotnet11-web-samples cd dotnet11-web-samples ./bench/bench.ps1 -Runs 3 -Requests 20 # quick check ./bench/bench.ps1 # 30 cold runs per variant 

Results land in bench/results-local.csv and bench/results-local.md. Your absolute numbers will differ. The JIT-versus-AOT gap is what should reproduce. If you run it, I'd love to see your numbers in the comments, especially on Apple Silicon or a real Linux box.

Test machine: Intel Core i7-1355U (12 logical CPUs), 16 GB, Windows 11 Pro, Docker 29.9.1 on WSL2. SDK images: 10.0.404 (runtime 10.0.15) and 11.0.100 (runtime 11.0.0). Run on 2026-11-21.