dotnet-performance
Comprehensive resource for .NET performance tuning, benchmarking, and memory optimization.
Install
mkdir -p .claude/skills/dotnet-performance && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/12599" && unzip -o skill.zip -d .claude/skills/dotnet-performance && rm skill.zipInstalls to .claude/skills/dotnet-performance
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Performance optimization and measurement for .NET applications. Navigation skill covering Span, ArrayPool, memory management, benchmarking, profiling, Native AOT, and optimization patterns. For building high-performance applications. Keywords: performance, optimization, span, arraypool, benchmarking, profiling, memory, gc, aot, native-aotKey capabilities
- →Optimize application performance and allocations.
- →Measure performance using BenchmarkDotNet.
- →Profile memory or CPU usage.
- →Build Native AOT applications.
- →Tune garbage collection.
- →Reduce memory allocations.
How it works
This skill acts as a navigation map to specialized skills for .NET performance optimization. It covers areas like zero-allocation coding, benchmarking, profiling, and Native AOT.
Inputs & outputs
When to use dotnet-performance
- →Optimizing memory usage in .NET
- →Setting up benchmarks for code
- →Profiling CPU and memory usage
About this skill
.NET Performance
Performance optimization and measurement for .NET applications. This meta-skill provides navigation to ~10 performance-focused skills covering zero-allocation coding, benchmarking, profiling, Native AOT, and optimization patterns.
When to Use This Skill
Load this skill when:
- Optimizing application performance and allocations
- Measuring performance with BenchmarkDotNet
- Profiling memory or CPU usage
- Building Native AOT applications
- Tuning garbage collection
- Reducing memory allocations
Quick Navigation
Optimization Patterns
| Need | Load Skill | Level |
|---|---|---|
| Span, ArrayPool, ref struct | dotnet-performance-patterns | Advanced |
| Type design for performance | dotnet-csharp-type-design-performance | Advanced |
| LINQ optimization | dotnet-linq-optimization | Intermediate |
Memory Management
| Need | Load Skill | Level |
|---|---|---|
| GC tuning, LOH/POH | dotnet-gc-memory | Advanced |
| Struct vs class decisions | dotnet-csharp-type-design-performance | Advanced |
Measurement
| Need | Load Skill | Level |
|---|---|---|
| BenchmarkDotNet setup | dotnet-benchmarkdotnet | Intermediate |
| Profiling tools | dotnet-profiling | Advanced |
| CI performance gates | dotnet-ci-benchmarking | Advanced |
AOT & Compilation
| Need | Load Skill | Level |
|---|---|---|
| Native AOT publishing | dotnet-native-aot | Advanced |
| AOT architecture patterns | dotnet-aot-architecture | Advanced |
| WASM AOT | dotnet-aot-wasm | Advanced |
| Trimming | dotnet-trimming | Intermediate |
| Multi-targeting | dotnet-multi-targeting | Intermediate |
Platform-Specific
| Need | Load Skill | Level |
|---|---|---|
| MAUI iOS/Catalyst AOT | dotnet-maui-aot | Advanced |
Performance Decision Trees
Which Optimization Technique?
Reduce allocations → Span<T>, ArrayPool<T> (dotnet-performance-patterns)
↓
Improve throughput → Struct optimization (dotnet-csharp-type-design-performance)
↓
Reduce startup time → Native AOT (dotnet-native-aot)
↓
Optimize queries → LINQ optimization (dotnet-linq-optimization)
Which Measurement Tool?
| Goal | Tool | Skill |
|---|---|---|
| Microbenchmarks | BenchmarkDotNet | dotnet-benchmarkdotnet |
| Live profiling | dotnet-trace | dotnet-profiling |
| Memory analysis | dotnet-counters | dotnet-profiling |
| Crash dumps | dotnet-dump | dotnet-profiling |
| CI gating | Automated benchmarks | dotnet-ci-benchmarking |
When to Use Native AOT?
| Scenario | Recommendation |
|---|---|
| CLI tools | Strongly recommended |
| Microservices | Consider for fast startup |
| Containers | Good for size reduction |
| Web APIs | Evaluate trade-offs |
| Libraries | Use IsTrimmable |
Complete Skill List
Optimization Patterns (3 skills)
dotnet-performance-patterns- Span, ArrayPool, ref structdotnet-csharp-type-design-performance- Struct vs class designdotnet-linq-optimization- IQueryable vs IEnumerable
Memory & GC (2 skills)
dotnet-gc-memory- GC tuning, LOH/POHdotnet-performance-patterns- Memory patterns
Benchmarking & Profiling (3 skills)
dotnet-benchmarkdotnet- BenchmarkDotNetdotnet-profiling- dotnet-counters, trace, dumpdotnet-ci-benchmarking- CI performance gating
AOT & Compilation (5 skills)
dotnet-native-aot- PublishAot, descriptorsdotnet-aot-architecture- AOT-first designdotnet-aot-wasm- Blazor/Uno WASMdotnet-trimming- Trimming annotationsdotnet-multi-targeting- Polyfills, multi-TFM
Platform-Specific (1 skill)
dotnet-maui-aot- MAUI iOS/Catalyst optimization
Build Optimization (2 skills)
dotnet-build-optimization- Slow build diagnosisdotnet-artifacts-output- UseArtifactsOutput
Performance Patterns
Zero-Allocation Patterns
// Use Span<T> instead of arrays
public void Process(Span<byte> data) { }
// Use ArrayPool<T> for temporary buffers
var buffer = ArrayPool<byte>.Shared.Rent(1024);
try { /* use buffer */ }
finally { ArrayPool<byte>.Shared.Return(buffer); }
// Use stackalloc for small fixed buffers
Span<int> stack = stackalloc int[100];
Struct Design
// Mark readonly for immutability
public readonly struct Point(double x, double y);
// Use ref readonly for large structs
public ref readonly Point GetOrigin();
// Seal classes for devirtualization
public sealed class Calculator { }
GC Optimization
- Use
GC.TryStartNoGCRegionfor critical sections - Pool objects to reduce Gen 0 collections
- Avoid LOH fragmentation with ArrayPool
- Consider GC configs for server apps
Cross-References
- Fundamentals →
dotnet-fundamentals - Architecture →
dotnet-architecture - Security →
dotnet-security - Web →
dotnet-web
Version Assumptions
- .NET 8.0+ for modern patterns
- Native AOT requires .NET 7.0+
- HybridCache requires .NET 8.0+
- BenchmarkDotNet works on all versions
Anti-Patterns to Avoid
- Premature optimization - Measure first
- Ignoring GC pressure - Monitor allocations
- Using ValueTask incorrectly - Don't await twice
- Async void methods - Always use Task
- Ignoring async state machine overhead - Consider sync for hot paths
See Also
- INDEX.md - Complete skill index
- TAXONOMY.md - Taxonomy schema
When not to use it
- →When the focus is on .NET fundamentals, architecture, security, or web development.
- →When using .NET versions older than 7.0 for Native AOT or 8.0 for modern patterns.
Limitations
- →It is a meta-skill that navigates to other skills, not an optimization tool itself.
- →Native AOT requires .NET 7.0+.
- →Modern patterns assume .NET 8.0+.
How it compares
This skill provides a structured entry point to various .NET performance topics by directing users to specific sub-skills, rather than offering a single, monolithic solution.
Compared to similar skills
dotnet-performance side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| dotnet-performance (this skill) | 0 | 5mo | No flags | Advanced |
| performance-benchmark | 3 | 4mo | No flags | Intermediate |
| asynkron-profiler | 0 | 1mo | Review | Intermediate |
| try-fix | 1 | 3mo | Review | Advanced |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by rudironsoni
View all by rudironsoni →You might also like
performance-benchmark
dotnet
Generate and run ad hoc performance benchmarks to validate code changes. Use this when asked to benchmark, profile, or validate the performance impact of a code change in dotnet/runtime.
asynkron-profiler
managedcode
Use the open-source free `Asynkron.Profiler` dotnet tool for CLI-first CPU, allocation, exception, contention, and heap profiling of .NET commands or existing trace artifacts. USE FOR: Asynkron.Profiler setup; automation-friendly profiling output; CPU, allocation, exception, contention, and heap inv
try-fix
dotnet
Attempts ONE alternative fix for a bug, tests it empirically, and reports results. ALWAYS explores a DIFFERENT approach from existing PR fixes. Use when CI or an agent needs to try independent fix alternatives. Invoke with problem description, test command, target files, and optional hints.
mutation-testing
SebastienDegodez
Use when running mutation testing, killing mutants, verifying test quality, checking mutation score, or analyzing survivors after the test baseline is green
dotnet-native-aot
rudironsoni
>-
complexity
managedcode
Use free built-in .NET maintainability analyzers and code metrics configuration to find overly complex methods and coupled code. USE FOR: the team wants to find overly complex methods; cyclomatic complexity thresholds are needed in CI; maintainability metrics or coupling thresholds need to be config