本文へスキップ
Skillpedia
APIとサーバー(バックエンド)5.8k · #14573

analyzing-dotnet-performance

できること

このスキルは、.NETのコードを既知の性能の問題について確認し、それぞれの直し方を説明します。リリースの前に、遅い、またはメモリを多く使うコードを見つけたい開発者のためのものです。

使う場面

  • ✓.NETのコードベースや、負荷の高い経路の性能の問題をレビューしたいとき。
  • ✓メモリを多く割り当てるコードの監査がほしいとき。
  • ✓手作業の性能レビューの後に、別の見方がほしいとき。

スキルのリンク

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

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/dotnet/skills/blob/main/plugins/dotnet-diag/skills/analyzing-dotnet-performance/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“このC#のサービスの負荷の高い経路の性能の問題を調べ、影響の大きい順に修正を並べてください。”

毎週5つの新しいスキル。1分で読めます。

仕組み

エージェントはコードを読み、アンチパターンのカタログと照らし、具体的な修正とともに優先順位の付いた指摘を報告します。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)を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
よくある質問

アルゴリズムを確認しますか?

いいえ。アルゴリズムの計算量ではなく、APIの使い方を見ます。

調査の深さを設定できますか?

はい。重大な問題だけ、標準、または包括的なレビューに絞れます。

負荷の高い経路を知っている必要がありますか?

あると、より良く動きます。負荷の高い経路にないコードは、変更が必要ないことがあるためです。

詳細

作者による元の説明

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

人気

GitHubのスター
5.8k
ランキング
#14573
ライセンス
MIT
更新日
2026/11/2

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル