Zum Inhalt springen
Skillpedia
APIs & Server (Backend)5.8k · #14573

analyzing-dotnet-performance

Was er macht

Dieser Skill prüft .NET-Code auf bekannte Leistungsprobleme und erklärt, wie jedes behoben wird. Er ist für Entwickler, die vor einer Veröffentlichung langsamen oder speicherhungrigen Code finden wollen.

Wann du ihn nutzt

  • ✓Wenn du eine .NET-Codebasis oder einen stark genutzten Codepfad auf Leistungsprobleme prüfen lassen willst.
  • ✓Wenn du eine Prüfung von Code willst, der viel Speicher anfordert.
  • ✓Wenn du nach einer manuellen Leistungsprüfung eine zweite Meinung willst.

Link zum Skill

https://github.com/dotnet/skills/blob/main/plugins/dotnet-diag/skills/analyzing-dotnet-performance/SKILL.md

Kopiere ihn und füge ihn in deine KI ein (Claude, ChatGPT oder Cursor) mit der Bitte, den Anweisungen zu folgen.

So nutzt du ihn

Am einfachsten: Kopiere die Nachricht und füge sie in deine KI ein. Sie liest den Skill und folgt den Anweisungen.

Fertige Nachricht zum Einfügen

Nutze diesen Skill, um mir zu helfen: https://github.com/dotnet/skills/blob/main/plugins/dotnet-diag/skills/analyzing-dotnet-performance/SKILL.md Lies die SKILL.md unter diesem Link und folge ihren Anweisungen für meine Aufgabe.
Soll deine KI Skills wie diesen selbst finden?Installiere den kostenlosen Skillpedia-MCP: eine Zeile, und sie durchsucht vor jeder Aufgabe 15.000+ Skills.In 1 Minute installieren →

Beispielanfrage an deine KI

“Prüfe diesen C#-Dienst auf Leistungsprobleme in seinen stark genutzten Pfaden und ordne die Korrekturen nach Wirkung.”

5 neue Skills pro Woche. 1 Minute Lesezeit.

So funktioniert es

Der Agent liest den Code, vergleicht ihn mit einem Katalog typischer Leistungsfallen und meldet priorisierte Befunde mit konkreten Korrekturen.

Technischer Inhalt (originale SKILL.md)

Originaltext des Autors, auf Englisch, direkt von GitHub.

.NET Performance Patterns

Scan C#/.NET code for performance anti-patterns and produce prioritized findings with concrete fixes. Patterns sourced from the official .NET performance blog series, distilled to customer-actionable guidance.

When to Use

  • Reviewing C#/.NET code for performance optimization opportunities
  • Auditing hot paths for allocation-heavy or inefficient patterns
  • Systematic scan of a codebase for known anti-patterns before release
  • Second-opinion analysis after manual performance review

When Not to Use

  • Algorithmic complexity analysis — this skill targets API usage patterns, not algorithm design
  • Code not on a hot path with no performance requirements — avoid premature optimization

Inputs

Input Required Description
Source code Yes C# files, code blocks, or repository paths to scan
Hot-path context Recommended Which code paths are performance-critical
Target framework Recommended .NET version (some patterns require .NET 8+)
Scan depth Optional critical-only, standard (default), or comprehensive

Workflow

Step 1: Load Critical Reference

Resolve bundled paths from the directory that contains this SKILL.md, not from the user's workspace. Load this reference file first:

  • references/critical-patterns.md

If a direct read fails, list this skill's references/ directory once and retry only when the listing shows the expected file. Do not use workspace file or text search to locate the skill installation.

Step 2: Detect Code Signals and Select Topic Recipes

Scan the code for signals that indicate which pattern categories to check. Use the ## Detection section from the critical reference when available and the inline recipes in Step 3 for initial signal detection.

After detecting signals, load only the topic-specific references selected by scan depth:

  • critical-only: No additional references (use only critical-patterns.md)
  • standard (default): Load references matching detected signals from this list:
    • references/async-patterns.md — async/Task/ValueTask signals
    • references/memory-and-strings.md — Span/Memory/string allocation signals
    • references/regex-patterns.md — Regex signals
    • references/collections-and-linq.md — Dictionary/List/LINQ signals
    • references/io-and-serialization.md — JsonSerializer/HttpClient/Stream signals
    • references/structural-patterns.md — always loaded (unsealed classes checked regardless)
  • comprehensive: Load all six topic-specific references above

For coverage reporting, the selected references are references/critical-patterns.md plus only the topic-specific references selected above. If any selected reference remains unavailable after retry, use the inline recipes in Step 3 for the missing coverage. Include Reference coverage: reduced; unavailable: <paths>; used inline recipes for missing references. in the final report, with <paths> replaced by the missing relative paths of the selected references only.

Use the ## Detection sections from loaded reference files and the inline recipes in Step 3 for categories whose reference files are unavailable.

Signal in Code Topic
async, await, Task, ValueTask Async patterns
Span<, Memory<, stackalloc, ArrayPool, string.Substring, .Replace(, .ToLower(), += in loops, params Memory & strings
Regex, [GeneratedRegex], Regex.Match, RegexOptions.Compiled Regex patterns
Dictionary<, List<, .ToList(), .Where(, .Select(, LINQ methods, static readonly Dictionary< Collections & LINQ
JsonSerializer, HttpClient, Stream, FileStream I/O & serialization

Always check structural patterns (unsealed classes) regardless of signals.

Scan depth controls scope:

  • critical-only: Only critical patterns (deadlocks, >10x regressions)
  • standard (default): Critical + detected topic patterns
  • comprehensive: All pattern categories

Step 3: Scan and Report

For files under 500 lines, read the entire file first — you'll spot most patterns faster than running individual grep recipes. Use grep to confirm counts and catch patterns you might miss visually.

For each relevant pattern category, run the detection recipes below. Report exact counts, not estimates.

Core scan recipes (run these when reference files aren't available):

# Strings & memory
grep -n '\.I
Häufige Fragen

Prüft es Algorithmen?

Nein. Es schaut darauf, wie APIs genutzt werden, nicht auf die Komplexität des Algorithmus.

Kann ich die Tiefe der Prüfung festlegen?

Ja. Die Prüfung kann auf kritische Probleme, Standard oder eine umfassende Prüfung begrenzt werden.

Muss er die stark genutzten Pfade kennen?

Mit ihnen funktioniert er besser, da Code außerhalb dieser Pfade oft keine Änderung braucht.

Details

Originalbeschreibung des Autors

Scans .NET code for ~50 performance anti-patterns across async, memory, strings, collections, LINQ, regex, serialization, and I/O with tiered severity classification. Use when analyzing .NET code for optimization opportunities, reviewing hot paths, or auditing allocation-heavy patterns.

repo: dotnet/skills

Beliebtheit

GitHub-Sterne
5.8k
Platz im Ranking
#14573
Lizenz
MIT
Aktualisiert
2.11.2026

Ist dieser Skill nützlich?

0

Anmelden um abzustimmen.

Kommentare

  • …

Weitere Skills aus diesem Repository

Ähnliche Skills