Introduction
There is no universal winner when comparing .NET Native AOT, JIT and ReadyToRun. Each publishing model optimizes a different part of the system: Native AOT removes the JIT at runtime and greatly reduces the time to the first response; ReadyToRun compiles part of the code ahead of time without giving up the dynamic runtime; a framework-dependent JIT application can share the installed runtime with other processes; and a self-contained JIT publish prioritizes operational isolation. Choosing only by the “CLI”, “server” or “serverless” label ignores the constraints that actually drive the result.
The decision has to start from the application’s measurable goal. Startup time matters for short-lived processes, but warmed-up throughput, p95 and p99, CPU, resident memory, distribution size, update frequency, compatibility with dynamic code and publish time can also decide the project. In this article, I compare the four models with the same code on .NET 10 and linux-x64, keeping the raw results. The conclusion is not a ready-made rule: it is a matrix that relates metrics and constraints to the operating context.
This text complements the guide .NET Native AOT: Part 1 — Compilation Ecosystem. In the conceptual guide, I explained Roslyn, IL, ILC, trimming and compatibility. Here, the focus is on correcting common simplifications with a reproducible experiment: separating a framework-dependent application from a self-contained distribution, separating startup from throughput, and not confusing managed allocation with RSS.
ℹ️ Info: every number in this article came from the lab’s CSVs and JSONs. Absolute values describe this workload, this hardware and this environment; the relationships between profiles are hypotheses for you to test, not guarantees for another application.
Prerequisites
- .NET SDK 10.0.400 or an equivalent Docker image.
- Docker Desktop with Linux containers to reproduce the Ubuntu 24.04 environment and the
linux-x64RID. - Basic knowledge of framework-dependent, self-contained, ReadyToRun and Native AOT publishing.
uvto run the deterministic consolidator of the CSVs and JSONs.- Microsoft Crank and Bombardier to repeat the HTTP load.
What the comments revealed about the AOT decision
A technical discussion about the conceptual article exposed the main flaw of recommendations based only on the application type. Saying that Native AOT is for CLIs and serverless, while JIT is for long-running servers, sounds useful because it fits in one sentence. The problem is that this sentence leaves out the goal. A CLI used once a month may not justify the compatibility effort; a backend replicated hundreds of times may value density and startup; a long-lived worker may depend on plugins; a stable CPU-bound service may get a different result from a service with a variable traffic distribution.
Startup is also not a synonym for a provider cold start. The lab measures the interval between starting a process and receiving a valid response from /ready, with a warm file system cache. A cold start on Azure Functions, AWS Lambda or another platform includes provider decisions, sandbox creation, image pull, networking, configuration and application initialization. I did not measure that path and, therefore, I do not attribute a universal gain in managed serverless to Native AOT.
Another important point is predictability. Removing the JIT avoids compiling methods during execution, but it does not remove GC pauses, operating system scheduling, contention, I/O or page faults. Likewise, source generators reduce dynamic discovery and move errors to build time, but they do not automatically make any architecture faster. They are relevant properties for the decision, not seals of superiority.
My revised rule is more demanding: define a goal, choose the metrics capable of refuting it and compare equivalent distributions. If the goal is to reduce the first response, measure new processes. If it is to increase density, measure RSS under representative load. If it is to sustain throughput, warm up the application and record tail latency and CPU together with requests per second.
Methodology: how to make the comparison fair
The experiment uses Ubuntu 24.04 on Docker Desktop, an Intel Core i5-1245U x64 processor, approximately 8 GB of available memory, SDK 10.0.400 and runtime 10.0.11. All profiles run in Release, Production environment, without logging providers and with the same payload. The code does not access a database, disk or external service during the measurement.

The workload receives Seed=42, ItemCount=2048 and Iterations=8. Each execution rents an array with ArrayPool<int>, generates deterministic values, sorts the data, computes the mean and the 95th percentile and produces a SHA-256. The Minimal API serializes the response with System.Text.Json source generation. This combination exercises CPU, allocation, generics and serialization without letting external I/O dominate.
The names combine the compilation mode with the distribution model:
- JIT (Just-In-Time) compiles IL into native code during execution.
- FDD (Framework-Dependent Deployment) publishes only the application and requires a compatible .NET runtime installed on the host.
- SCD (Self-Contained Deployment) includes the .NET runtime in the published directory.
- R2R (ReadyToRun) compiles eligible assemblies ahead of time, but keeps the runtime and the JIT.
- Native AOT (Native Ahead-Of-Time) generates a self-contained native binary before execution, with no JIT in production.
The four profiles are:
| Profile | Runtime in the directory | Ahead-of-time code | JIT at runtime |
|---|---|---|---|
| JIT FDD (framework-dependent) | No; uses a compatible installation | Runtime libraries may contain R2R | Yes |
| JIT SCD (self-contained) | Yes | Runtime libraries may contain R2R | Yes |
| R2R SCD (self-contained ReadyToRun) | Yes | Application and eligible dependencies | Yes |
| Native AOT (self-contained native) | Reduced runtime included | Closed application in native code | No |
The harness restores dependencies before the stopwatch starts, runs three pairs of clean and incremental publishes and starts each profile 30 times in randomized order. Before measuring startup, it copies the publishes to the container’s local Linux file system; running large binaries directly from the Windows bind mount added almost ten artificial seconds in preliminary tests.
For the warm state, BenchmarkDotNet uses real out-of-process jobs for .NET 10 JIT and Native AOT. The HTTP load uses Microsoft Crank with Bombardier, 64 connections, 15 seconds of warm-up and 30 seconds of measurement. The application and the generator run in separate containers, but on the same physical machine. That contaminates the absolute capacity, so I use the results only as a relative comparison in this environment.
Practical Example: reproducible lab in .NET 10
The API was built with the slim ASP.NET Core host. The marker written after Start() allows Crank to synchronize the load without enabling different logs across profiles:
| |
📂 Source Code: The complete example is available in the blog’s samples repository:
BlogSamples/NativeAot/DecisionLab/
The main command publishes, measures size and runs the 120 startups inside the pinned image:
| |
The manifest records the commit, worktree state, source fingerprint and environment. The fingerprint is necessary because a HEAD hash does not identify changes that are not yet committed. The consolidator computes the median, minimum, maximum, median absolute deviation (MAD) and the ratio against JIT FDD; differences of up to 3% are flagged as within the operational noise threshold, without pretending to be statistically significant.
Publish, size and process startup
Native AOT moved cost to the build. The median clean publish took 98.145 seconds, against 11.589 seconds for JIT FDD, 28.450 seconds for JIT SCD and 25.812 seconds for R2R SCD. In the incremental publish, the gap narrowed: Native AOT took 13.398 seconds; JIT FDD, 11.679; JIT SCD, 14.552; and R2R SCD, 13.787.
| Profile | Median clean publish | Median incremental publish |
|---|---|---|
| JIT FDD | 11.589 s | 11.679 s |
| JIT SCD | 28.450 s | 14.552 s |
| R2R SCD | 25.812 s | 13.787 s |
| Native AOT | 98.145 s | 13.398 s |
Size requires a careful comparison. The 165,687 bytes of JIT FDD represent only the application files; the shared .NET installation is outside the directory. JIT SCD and R2R SCD include the runtime and libraries and came close to 109.7 MB. Native AOT included the required reduced runtime and reached 28.3 MB. Compressed, the directories took 81,471 bytes, 48.2 MB, 48.2 MB and 10.9 MB, respectively.
| Profile | Compared unit | Uncompressed | ZIP |
|---|---|---|---|
| JIT FDD | Application, without installed runtime | 165,687 B | 81,471 B |
| JIT SCD | Complete distribution | 109,703,386 B | 48,156,909 B |
| R2R SCD | Complete distribution | 109,745,882 B | 48,177,185 B |
| Native AOT | Complete distribution | 28,306,209 B | 10,865,327 B |
In process startup, Native AOT showed a median of 63.794 ms and a MAD of 8.948 ms. JIT FDD recorded 587.644 ms; JIT SCD, 633.357 ms; and R2R SCD, 585.283 ms. R2R and JIT FDD stayed within the 3% operational threshold, so this experiment does not support declaring R2R the startup winner.
| Profile | Median startup | MAD | Samples |
|---|---|---|---|
| JIT FDD | 587.644 ms | 100.856 ms | 30 |
| JIT SCD | 633.357 ms | 93.885 ms | 30 |
| R2R SCD | 585.283 ms | 79.038 ms | 30 |
| Native AOT | 63.794 ms | 8.948 ms | 30 |
⚠️ Warning: these numbers measure a new process with a warm file system cache. They do not measure machine boot, container pull or a serverless provider cold start.
Shared runtime and self-contained units
Framework-dependent is an efficient choice when several applications use a compatible .NET installation on the same host. The cost of the runtime does not disappear; it is installed, updated and potentially shared outside the application artifact. In isolated containers or hosts without a runtime, this premise changes.
Each Native AOT publish is a self-contained unit and carries the parts of the runtime it needs. In the documented publishing model, there is no common Native AOT runtime consumed by several independent managed executables. The operating system can share read-only pages between processes of the same binary, but that is virtual memory behavior and does not turn different executables into clients of a common runtime.
ℹ️ Info:
UnmanagedCallersOnlycan export C entry points from a Native AOT module for native interop. That does not create a managed AOT DLL shared between .NET applications.
Throughput, latency and memory under load
The HTTP campaign uses the same endpoint and payload in all four profiles. I record the median and dispersion of requests per second, p50, p95, p99, maximum process CPU and maximum working set across five randomized rounds per profile. Since the application and Bombardier share the same physical machine, the numbers do not represent maximum production capacity.
The 20 rounds finished with zero invalid responses. JIT FDD had the highest median, 932 RPS, followed by Native AOT with 810 RPS, JIT SCD with 803 RPS and R2R SCD with 734 RPS. Dispersion was high: the MAD ranged from 82 RPS on JIT SCD to 240 RPS on R2R SCD, and the observed ranges overlap. On this shared host, the order of the medians does not support a general throughput rule.
| Profile | Median RPS | RPS MAD | p50 | p95 | p99 |
|---|---|---|---|---|---|
| JIT FDD | 932 | 130 | 63.936 ms | 136.854 ms | 194.880 ms |
| JIT SCD | 803 | 82 | 78.570 ms | 142.288 ms | 210.696 ms |
| R2R SCD | 734 | 240 | 83.483 ms | 191.594 ms | 312.714 ms |
| Native AOT | 810 | 186 | 79.518 ms | 145.527 ms | 210.021 ms |
The clearest signal appeared in resources. Native AOT recorded a median of 41 MB for the maximum working set, against 103 MB on JIT FDD, 101 MB on JIT SCD and 96 MB on R2R SCD. The median maximum CPU was 62% on Native AOT, 83% on JIT FDD, 79% on JIT SCD and 86% on R2R SCD. These are maxima sampled by Crank, not average consumption or private memory.
| Profile | Median maximum CPU | Median maximum working set | Working set MAD |
|---|---|---|---|
| JIT FDD | 83% | 103 MB | 2 MB |
| JIT SCD | 79% | 101 MB | 2 MB |
| R2R SCD | 86% | 96 MB | 2 MB |
| Native AOT | 62% | 41 MB | 1 MB |
ℹ️ Info: in this campaign, Native AOT used about 40% of the median maximum working set of JIT FDD. The result is specific to this AOT-friendly workload and does not predict the RSS of another application.
JIT, Dynamic PGO and Native AOT in hot code
ReadyToRun does not eliminate the JIT. With tiered compilation enabled, frequently used methods can have their R2R code replaced by code produced by the optimizing JIT. Dynamic PGO works together with this mechanism: it instruments execution, observes hot types and paths and uses that data to recompile relevant methods.
Native AOT has no JIT in production, so it cannot adapt the code during execution in the same way. That is a difference in capability, not proof that JIT always wins. AOT code avoids compilation warm-up and can tie or beat the JIT in specific workloads; the JIT can benefit when the process lives long enough and the observed distribution guides useful optimizations.
In SDK 10.0.400 and in the public sources I consulted, I did not confirm a stable, documented build-time PGO flow for Native AOT that could be recommended as a production procedure in this lab. For that reason, the comparison uses the supported defaults and does not include experimental options. Even when an offline profile is available, it needs to represent production: changes in types, routes or traffic distribution can age the collected evidence.
The two jobs completed by the same BenchmarkDotNet run produced a median of 1.034 ms for JIT and 1.638 ms for Native AOT. In this warm workload, Native AOT took 1.585 times the time of the JIT baseline. Managed allocations were close: 8,984 bytes per operation on JIT and 9,370 bytes on Native AOT, a 4.3% difference.
| Runtime | Median | MAD | Samples | Allocation per operation |
|---|---|---|---|---|
| .NET 10 JIT | 1.034 ms | 0.133 ms | 92 | 8,984 B |
| Native AOT 10 | 1.638 ms | 0.161 ms | 99 | 9,370 B |
BenchmarkDotNet flagged the Native AOT distribution as bimodal (mValue = 3.25) and removed one outlier; on JIT, it removed eight outliers. So the result refutes the hypothesis of a tie in this run, but it does not show that JIT always wins in hot code. It only shows that, for this load, in this environment and with the supported defaults, the adaptation available in the JIT runtime coincided with a lower median duration.
Source generators and reflection change the cost
The workload uses System.Text.Json source generation. The JSON context registers the contracts used by the API, allowing the compiler to see which metadata must be preserved. That reduces reflection-based discovery and makes the scenario deliberately compatible with Native AOT.
Reflection is not a single block. Analyzable access to metadata or preserved members can work with annotations and tests. The strongest problems appear when the set of code is only known at runtime: Assembly.LoadFile, Reflection.Emit, open plugins and serializers that discover arbitrary types. The trimmer needs to see the graph at build time; otherwise, it cannot prove what it can remove.
Avoiding dynamic code can be a healthy architectural decision, especially when source generators and explicit contracts surface errors earlier. It can also be unfeasible for a product whose value depends on open extensibility. Compatibility should have its own row in the decision matrix; it should not be treated as a detail solved by a generic attribute that preserves everything.
Where the conclusions do not apply directly
Hard real-time requires end-to-end predictability. The absence of a JIT does not control GC pauses, operating system scheduling, interrupts, I/O, locks or page faults. Soft real-time, on the other hand, can work with a warmed-up and measured JIT process. This lab does not measure deadlines and does not use a real-time operating system.
Blazor WebAssembly AOT is a different pipeline. It compiles .NET code to WebAssembly executed by the browser and usually trades a larger download for better performance in CPU-intensive sections. It is not the same Native AOT executable model for Linux, Windows or macOS. Blazor Server is closer to the decision for an ASP.NET Core backend, but features and dependencies need to be evaluated separately.
There are also no results for .NET 11 previews, exported Native AOT libraries, serverless providers or applications with databases. Including those scenarios without measuring them would increase the apparent scope and reduce the usefulness of the conclusion.
Goal-oriented decision matrix
| Goal or constraint | Measurement question | Options that deserve a baseline |
|---|---|---|
| First response | How long does a new process take to respond? | Native AOT, R2R and JIT |
| Warm throughput | Which profile sustains RPS with acceptable p95/p99? | JIT with tiering/PGO and Native AOT |
| Memory and density | What is the RSS under load per replica? | Native AOT, JIT FDD and JIT SCD |
| Distribution | How many bytes are transferred and updated? | FDD if a runtime exists; AOT/SCD if not |
| Shared runtime | Do several applications use the same managed host? | JIT FDD |
| Plugins and dynamic code | Is the code graph known at build time? | JIT; validate trimming before AOT |
| Build time | Does the delivery frequency tolerate an AOT publish? | JIT/R2R as baseline |
| Operations | Do diagnostic tools cover the chosen mode? | Validate per environment and expected incident |
A CLI distributed to machines without .NET may value Native AOT for startup and packaging. Many applications on a managed host can take advantage of FDD. A long-lived, variable backend can benefit from JIT adaptation. Edge and IoT may prioritize bytes, memory and execution constraints. These examples guide which tests to run; none of them replaces measurement.
Limitations of the experiment
The hardware is a notebook with Docker Desktop 4.81.0, and the application and the load generator compete for the same CPU. The RID is only linux-x64, the system is Ubuntu 24.04 and the Equilibrado (balanced) power plan was observed during the campaign. That does not control frequency, temperature or host background tasks, which may increase dispersion. The campaign uses a warm file system cache and does not restart the operating system between samples.
The workload is synthetic, deterministic and deliberately AOT-friendly. It does not represent database access, external network, plugins, open type discovery or a large codebase. The memory reported by Crank is the maximum working set, while BenchmarkDotNet records managed allocation per operation; these metrics answer different questions.
Three publishes and 30 startups make it possible to observe operational dispersion, but they do not turn the lab into a universal study. The five HTTP rounds help detect instability, and the 3% threshold avoids announcing small differences as winners. Even so, the threshold is not a formal significance test.
Tips and Good Practices
Start with a simple baseline. First compare the default publish your team already operates. Native AOT and ReadyToRun need to improve a relevant metric enough to pay for the cost of compatibility, build and maintenance.
Run performance tests in Release and Production. Debug and the Development environment add work and configuration that distort results. Keep logging, GC, payload and functionality the same across profiles whenever the publishing mode allows it.
Measure distributions, not a single run. Use new processes for startup, explicit warm-up for steady state and randomized order. Record the median and dispersion so you do not confuse thermal noise, cache or background tasks with a compiler effect.
Separate application size from distribution size. App-only FDD assumes an installed runtime; SCD and Native AOT include the runtime. Declare the compared unit and, when transfer matters, also measure the compressed artifact.
Keep raw data and environment. CSV, JSON, manifest, commit and source fingerprint make each table auditable. Copying numbers manually into Markdown without traceability makes unit and rounding errors easier.
Treat invalid responses as a test failure. High RPS with HTTP 400, 500 or timeouts is not application performance. Automate a gate that requires zero bad responses before consolidating the round.
Track regressions in CI with noise tolerance. An isolated benchmark does not prevent dependencies or workload changes from altering the result. Use a stable machine and only alert when the difference exceeds the scenario’s historical variability.
Objective Summary
- Choosing between JIT, ReadyToRun and Native AOT — there is no universal winner; first response, throughput, tail latency, CPU, memory, distribution and compatibility answer different questions.
- Native AOT startup in this environment — the median was 63.794 ms over 30 processes, against 587.644 ms for JIT FDD; the measurement uses a warm file system cache and does not represent a provider cold start.
- Native AOT publish in this environment — the median clean publish took 98.145 s, while the incremental one took 13.398 s; the highest cost was concentrated in the clean compilation.
- JIT FDD size — the 165,687 bytes measured cover only the application and assume a compatible installed runtime, so they are not directly comparable to complete self-contained distributions.
- Native AOT size — the complete distribution reached 28,306,209 bytes uncompressed and 10,865,327 bytes in ZIP, including the required parts of the runtime without a JIT.
- ReadyToRun — keeps IL, runtime, JIT and tiered compilation; in this startup test, R2R SCD and JIT FDD stayed within the 3% operational threshold.
- HTTP load in this environment — JIT FDD had a median of 932 RPS, Native AOT 810, JIT SCD 803 and R2R SCD 734; Native AOT recorded a 41 MB median maximum working set against 103 MB on JIT FDD, but the high dispersion prevents generalizing capacity.
- Hot code in this workload — the median was 1.034 ms on JIT and 1.638 ms on Native AOT; the report flagged the AOT distribution as bimodal, so the conclusion remains limited to this run.
Read Also
- .NET Native AOT: Part 1 — Compilation Ecosystem
- Parallelism in C#: Parallel, PLINQ and Tasks in Practice
- .NET Worker with BackgroundService for High Volume
- C# as a Script in .NET: How to Use It and When It Pays Off
References
- Native AOT deployment overview — publishing model, requirements, reduced runtime and official limitations.
- Native code interop with Native AOT — direct P/Invoke and C exports with
UnmanagedCallersOnly. - ReadyToRun deployment overview — R2R format, size impact and interaction with tiered compilation.
- Compilation config settings — tiered compilation, ReadyToRun and dynamic PGO.
- Known trimming incompatibilities — reflection-based serializers, dynamic generation and assembly loading.
- Blazor WebAssembly AOT — WebAssembly pipeline and the trade-off between download and execution.
- BenchmarkDotNet NativeAOT — out-of-process jobs and toolchains for different runtimes.
- Microsoft Crank — controller, agents and load jobs used by the .NET team.
- ASP.NET Core load and stress testing — guidance for running load in Release and Production.

By commenting, you agree to our Privacy Policy, Terms of Use, Data Deletion Policy.