Skip to content
Matthew Adams By Matthew Adams Co-Founder · 9 min read
How .NET 11.0 boosted JSON Schema performance by 3%

At endjin, we maintain Corvus.JsonSchema, an open source high-performance library for serialization and validation of JSON using JSON Schema.

Each time a new version of .NET ships, we run the same benchmark on the new runtime, with no code changes at all, to see what we get "for free".

Now that .NET 11.0 has been released, we can see another boost. This time it is a modest one. We get ~3% "for free" just for switching out the runtime.

That is the smallest step we have seen since we started this series. It still means that the same V4 code validates the same document 34% faster on .NET 11 than it did on .NET 8.

Programming C# 12 Book, by Ian Griffiths, published by O'Reilly Media, is now available to buy.

There is something new this year, too. Last year I said that we were working on vNext of Corvus.JsonSchema, and that it would offer a 2-10x improvement in validation efficiency. That is now shipping as our V5 engine, Corvus.Text.Json. So this year we start a second series for V5, beginning with .NET 10 v .NET 11.

Here are the details.

The Benchmark

We run the benchmark on an Azure Standard_D8s_v6 virtual machine: Intel Xeon Platinum 8573C, 1 CPU, 8 logical and 4 physical cores, with Ubuntu 24.04.

Last year we used a laptop, running Windows. The absolute numbers are not comparable with last year's post, so we have run every runtime again. It is the relative values that matter.

The dotnet versions are as follows: .NET 11.0.0 (11.0.0, 11.0.26.53018), X64 RyuJIT x86-64-v4 .NET 10.0.12 (10.0.12, 10.0.1226.42308), X64 RyuJIT x86-64-v4 .NET 9.0.20 (9.0.20, 9.0.2026.41315), X64 RyuJIT x86-64-v4 .NET 8.0.31 (8.0.31, 8.0.3126.42015), X64 RyuJIT x86-64-v4

We are validating a large array consisting of 10,000 small JSON documents. This is typical of a small JSON payload in a web API. It includes some strings, some formatted strings (e.g. email, date), and some numeric values.

{
    "name": {
        "familyName": "Oldroyd",
        "givenName": "Michael",
        "otherNames": [],
        "email": "michael.oldryoyd@contoso.com"
    },
    "dateOfBirth": "1944-07-14",
    "netWorth": 1234567890.1234567891,
    "height": 1.8
}

A note on measuring small differences

When the difference between two runtimes is 18%, almost any careful measurement will find it. When it is 3%, the measurement itself needs more care.

We use a virtual machine with no other work running in it, and pin the benchmark to six of its eight logical cores. We also ask BenchmarkDotNet to run each runtime in six separate processes, rather than its default of one. We found that a single process can settle into a slightly faster or slower state for its whole life, and that the difference between two launches of the same runtime can be as large as the difference we are trying to measure. We then ran the whole thing three times. The figures below are the average of the three runs, which is eighteen launches of each benchmark on each runtime.

The V4 engine, from .NET 8.0 to .NET 11.0

This is the like-for-like series. It is the same benchmark, and the same V4 generated code, that we have measured in previous years.

Method Runtime Mean Ratio Allocated
ValidateLargeArrayCorvusV4 .NET 8.0 15.285 ms 1.00 -
ValidateLargeArrayCorvusV4 .NET 9.0 13.251 ms 0.87 -
ValidateLargeArrayCorvusV4 .NET 10.0 10.309 ms 0.67 -
ValidateLargeArrayCorvusV4 .NET 11.0 10.019 ms 0.66 -

Here is each release against the one before it.

Step Improvement
.NET 8.0 to .NET 9.0 13%
.NET 9.0 to .NET 10.0 22%
.NET 10.0 to .NET 11.0 3%
.NET 8.0 to .NET 10.0 (LTS to LTS) 33%
.NET 8.0 to .NET 11.0 34%

The first thing to say is that the older figures are in line with last year's. On a laptop, on Windows, we measured 14% for .NET 9 and 18% for .NET 10, and 29% from LTS to LTS. On a different CPU and operating system, and after a year of servicing updates, we get 13%, 22% and 33%.

The second is that .NET 11.0 is no worse than .NET 10.0, and on this benchmark it takes just under 3% off the time. Our three runs gave 2.9%, 2.2% and 3.3%. That is close to the smallest difference that this benchmark can resolve, so treat it as "no worse" rather than as a precise figure.

If you have a LTS-based upgrade cycle, the numbers to look at are still .NET 8 and .NET 10. If you are prepared to move to an STS release, you get the .NET 11 improvement on top.

A regression that came and went

The first release candidate told a slightly different story. While we were measuring RC1, we found a change in the way the JIT copies small structs that contain object references. It made those copies a good deal faster when the destination was on the heap, and about 9% slower, on the Intel Core i7-13800H in our laptop, when it was on the stack. Our V4 code passes a small validation context struct by value through every call, so it does a lot of the second kind.

We reported it to the .NET team with a small standalone reproduction. It turned out that RC2 and later already behave differently. When we ran the same copy on RC2 it was faster than .NET 10 in both cases, and it is on the release, too. The figures in this post are from the released version of .NET 11.0, rather than from RC2.

This is a good reason to run your own benchmarks against the release candidates. The earlier you find something, the more chance there is of it being dealt with before the release.

The V5 engine, .NET 10.0 v .NET 11.0

V5 is a ground-up rebuild of the library. It has its own JSON document model in Corvus.Text.Json, and a new code generator.

It gives you three ways to validate a document against a schema, and we measure all three with exactly the same document and schema that we use for V4.

  1. The generated types. You call EvaluateSchema() on a strongly typed value that the code generator has produced from your schema.
  2. The generated standalone evaluator. You generate just a validator for the schema, without the types.
  3. The dynamic validator. You load a schema at runtime, with no build-time code generation at all.

All three are front ends to the same engine. The schema is compiled into an evaluation plan, and one evaluator runs that plan over the document. So we expect the three to agree, and they do.

We build the benchmark once, for net10.0, and run exactly the same binaries on both runtimes.

Method Runtime Mean Ratio Allocated
ValidateLargeArrayCorvusV5GeneratedTypes .NET 10.0 1.709 ms 1.00 -
ValidateLargeArrayCorvusV5GeneratedTypes .NET 11.0 1.701 ms 1.00 -
ValidateLargeArrayCorvusV5StandaloneEvaluator .NET 10.0 1.743 ms 1.00 -
ValidateLargeArrayCorvusV5StandaloneEvaluator .NET 11.0 1.705 ms 0.98 -
ValidateLargeArrayCorvusV5DynamicValidator .NET 10.0 1.764 ms 1.00 -
ValidateLargeArrayCorvusV5DynamicValidator .NET 11.0 1.717 ms 0.97 -

There are two things to notice here.

The first is the comparison with V4. On .NET 11.0, V4 validates the array in 10.0 ms. V5 does it in 1.7 ms. That is around 6 times faster, and still with zero allocations, which sits comfortably inside the 2-10x that we were hoping for last year. It also means that you do not pay a throughput penalty for loading your schema at runtime.

The second is that, for V5, .NET 11.0 is no worse than .NET 10.0. The averages for the three paths are 0.5%, 2% and 3% faster, but individual runs ranged from 2% slower to 4% faster, so the difference is within the experimental error.

This is the first entry in the V5 series, and we will carry it forward with each .NET release from here.

Notes on older runtimes

.NET 7.0 is no longer supported, and we dropped it from the benchmarks last year. .NET 8.0 and .NET 9.0 both went out of support on 10 November 2026, the day that .NET 11.0 was released, so expect .NET 9.0 to disappear from next year's table. V5 does not target .NET 8.0 directly, which is why its series begins at .NET 10.0.

Is this the end of the free lunch?

As always, we question whether we are seeing the end of the free lunch. Not necessarily, but we are very, very close to the performance of hand-tuned Rust code, and any further optimizations will be very difficult to achieve in the runtime alone.

We can put a number on that, because we also maintain a Rust port of the V5 evaluator, with the same design. The Bowtie benchmarks run both over 37 real-world schemas. In the run of 29 November 2026, our .NET implementation (Corvus.Text.Json 5.8.12) compiled with native AOT (on .NET 10) took, as a geometric mean, 8% longer than the Rust one to parse and validate the documents, and 15% longer to validate them once warm. If we let the JIT compile the schema to code at runtime, which native AOT cannot do, warm validation takes about half the time of the Rust version, although that configuration is a good deal slower to parse the documents.

Raw speed isn't the only thing that improves from release to release, either. The JIT improvements in .NET 11 include removing more redundant bounds checks (for index-from-end access such as values[^1], and after an empty-span guard), folding multi-target switch expressions into branchless checks, removing redundant checked arithmetic contexts and redundant branches, and devirtualizing generic virtual methods. That means that we could write slightly more compact, expressive, less performance-aware code, and still get the performance that we get today.

Looking at the future

With V5 shipping, we now have two engines to follow through the next few .NET releases. V4 remains the like-for-like measure that stretches back to .NET 8, and V5 shows what the runtime improvements mean for code that was already designed to get the most from it.

Matthew Adams

Co-Founder

Matthew Adams

Matthew was CTO of a venture-backed technology start-up in the UK & US for 10 years, and is now the co-founder of endjin, which provides technology strategy, experience and development services to its customers who are seeking to take advantage of Microsoft Azure and the Cloud.