.NET performance laboratory for AI agents

Make your .NET
application faster.

Open source under Apache-2.0. View on GitHub

Give your AI coding agent a performance goal. DotNetLab equips it to find bottlenecks, implement optimizations, and verify the gains with profiling tools, C# optimization guidance, and the scientific method.

Start with your existing application. Profile running .NET processes without code changes.

For Codex, Claude Code, Cursor & Google Antigravity

Your agent + DotNetLabMCP + Skill

START WITH A GOAL

You ask. Your agent investigates.

Use DotNetLab to improve this application's performance. Find the largest bottlenecks, implement candidate optimizations, and retain changes supported by measurements and correctness checks.
  1. 01
    Find the expensive workProfile CPU, allocations, and GC in your workload.
  2. 02
    Improve the codeTest focused changes guided by the bottleneck.
  3. 03
    Verify the improvementCheck correctness and retest in fresh builds.
Your coding agent writes the changes. DotNetLab supplies the tools and experimental guidance.

Windows & Linuxx64 platforms

.NET 6+ applicationsCoreCLR targets · .NET 10+ to run DotNetLab

Your existing codeNo code changes for initial profiling

Open sourceApache-2.0 · MCP server + agent skill

MEASURED WITH DOTNETLAB · WILDCARDMATCH

One repeated scan.
66.4% less time.

Time per matching call on dense inputs with a 16,384-character prefix in Tedd.WildcardMatch.

The matcher repeatedly checked an already-scanned prefix for newlines. Tracking how far it had checked let each retry scan only the new interval.

DotNetLab compared the source change with the original in fresh processes. The smaller dense-input scenario improved by 27.4%; ordinary inputs stayed within the declared ±5% equivalence margin.

Inspect the measured code change

DENSE-16384 · TIME PER MATCHING CALL

Original8.260 ms
Optimized2.772 ms

10 paired fresh-process blocks per scenario.
Correctness checks passed in all 80 sessions across four scenarios.

Windows x64 · .NET 10.0.12 · Ryzen 9 5950X
Geometric mean time per call for this synthetic matching workload.
All four scenarios, measurement method, and source data
Fresh-process confirmation · 15 October 2026
ScenarioOriginal ns/callOptimized ns/callResult
Dense · 4,096-character prefix654,963.0475,514.927.4% less time
Dense · 16,384-character prefix8,259,676.32,771,530.966.4% less time
Ordinary84.984.7Equivalent within ±5%
Newline155,255.8127,016.418.2% less time

Each scenario used ten randomized paired blocks, with a separate baseline and candidate process per block, two warm-up batches, and no excluded or replacement runs. Timings are geometric means of batch means. Four comparisons shared a 5% error budget; the dense-16384 candidate/baseline ratio was 0.3355, with a 98.75% interval of 0.2871–0.3922.

The study covered one pattern and four synthetic input distributions. Host load, CPU affinity, frequency, and thermal state were uncontrolled. The results describe these matching calls; application throughput depends on its workload.

Read the measurement data and protocol

TECHNICAL CAPABILITIES

Runtime diagnostics.
Code inspection.

Profile CPU and memory, inspect generated code, test live method changes, and compare .NET runtimes. Give your agent the evidence to explain expensive work and investigate improvements.

MEMORY & RUNTIME

Allocations, GC, and runtime events

Allocation stacks, per-generation GC pauses, runtime counters, contention and JIT events, and correlation of GC suspensions with measured execution windows.

NATIVE CODE & DISASSEMBLY

JIT x64 assembly

Live native-code snapshots, IL/metadata inspection, Iced disassembly, and instruction diffs to investigate inlining, bounds checks, and vectorization.

CORECLR REJIT

Live C# method replacement

Import a selected compiled method body and test it through CoreCLR ReJIT while retaining the process and application objects. Supported bodies include instance fields, floating-point arithmetic, arrays, spans, refs, structs, and existing SIMD calls.

METHOD INSTRUMENTATION

Selected method probes

Instrument supported methods for invocation counts, normal/exceptional outcomes, and optional timing, with setup validation and original-body restoration.

RELEASES & PREVIEWS

Runtime comparisons

Discover installed .NET runtimes and pin an exact release or preview using target_runtime_version. Windows Core_Root/corerun development builds have a separate quiet-validation workflow.

THE SCIENTIFIC METHOD

Observe. Hypothesize.
Experiment. Verify.

Your agent follows an experimental loop: measure a real bottleneck, explain its cause, test a focused change, and check whether the improvement survives independent confirmation.

01 / OBSERVE

Find what costs time.

Profile your workload to locate CPU hotspots, allocations, and GC pauses. Your agent forms a testable hypothesis about the expensive work and the change that could reduce it.

02 / EXPERIMENT

Implement and test a change.

Your agent edits the code, checks its outputs, and compares it with the baseline. Metrics and acceptance criteria are fixed before timing; randomized trials help separate gains from noise.

03 / VERIFY

Keep the supported gains.

Retest baseline and candidate builds in fresh, profiler-free processes. Retain changes that pass performance and correctness checks, revert unsupported candidates, then profile again.

Explore the statistical methods

PROFILING TOOLS + OPTIMIZATION EXPERTISE

From a slow path
to better code.

The MCP server gives your agent access to the runtime. The companion skill guides algorithm, memory, JIT, SIMD, and concurrency optimizations based on the bottleneck it measures.

MEMORY & ALLOCATIONS

Reduce allocation pressure.

Trace allocation stacks and GC pauses. Test spans, buffer reuse, and data-layout changes while checking their effect on both speed and allocated bytes.

JIT & SIMD

See what the CPU executes.

Inspect generated x64 assembly to check inlining, bounds checks, and vectorization. Compare the machine code behind a proposed C# optimization.

LIVE REJIT

Test changes in a running process.

With the optional native profiler, replace supported method bodies while retaining application state. Validate the candidate and restore the original between experiments.

LATENCY & CONCURRENCY

Investigate the slow requests.

Measure per-operation latency and compare p95 and p99. Use contention and runtime evidence to guide experiments with synchronization, batching, and concurrency.

REPEATABLE EVIDENCE

Know which changes hold up.

Compare candidates with confidence intervals and correctness checks. Confirm gains in normal builds, with plans, results, and decisions retained across agent sessions.

Initial profiling needs no application code changes. For controlled comparisons, your agent integrates the cooperative harness with repeatable inputs and correctness checks. Harness guide ↗

Native workflows require the optional profiler. Live profiler attachment is supported on Windows x64; Linux x64 supports startup instrumentation. Platform details ↗

START WITH YOUR WORKLOAD

Set the goal.
Let your agent investigate.

Bring an application, library, service, or batch job. Describe the cost you want to reduce; your agent uses DotNetLab to profile the workload and test improvements.

  • Spend less CPU time on a hot path.
  • Allocate fewer objects per operation.
  • Reduce latency under representative load.
agent / investigation prompt

// Process more work in the same time.

Use DotNetLab to improve this library's throughput.

Profile a representative workload and identify
the largest CPU costs. Implement and compare
candidate optimizations, checking output correctness
and allocations. Confirm the gains in fresh builds.
profile → optimize → verify

GET STARTED

Your application.
Your first investigation.

The installer configures the CLI, MCP server, and companion skill for Codex, Claude Code, Cursor, and Google Antigravity. It downloads a matching release, or builds from source when no release matches.

Run DotNetLab with a .NET 10+ runtime or SDK on Windows x64 or Linux x64. It can investigate .NET 6+ CoreCLR applications.

After installation, restart your coding client, verify compatibility, and open your application's repository. Give your agent the starting prompt and a workload to exercise.

Client selection and installation options

01 / INSTALL FOR YOUR CODING CLIENTS

irm https://raw.githubusercontent.com/tedd/Tedd.DotNetLab/main/tools/install.ps1 | iex

02 / RESTART YOUR CODING CLIENT

Start a new session so the MCP tools and skill load.

03 / VERIFY COMPATIBILITY IN YOUR TERMINAL

dotnetlab compatibility

04 / OPEN YOUR PROJECT AND ASK YOUR AGENT

Find the largest bottlenecks, implement candidate optimizations, and verify the gains.

Linux trace parsing requires delegated cgroup v2 memory and pids controllers. WSL catalogs require a local Linux filesystem. Setup guide ↗

GO DEEPER