本文へスキップ
Skillpedia
デプロイとクラウド(DevOps)5.8k · #14593

build-perf-baseline

できること

このスキルは、改善を証明できるように、.NETプロジェクトの公正なビルドの計測を設定します。何かを変える前に、ビルドがどれだけ遅いかを知りたいチームのためのものです。

使う場面

  • ✓.NETのビルドが遅く、何かを変える前に信頼できる数値がほしいとき。
  • ✓変更の前後のビルドを比べたいとき。
  • ✓コールド、ウォーム、変更なしのビルドを別々に計測したいとき。

スキルのリンク

https://github.com/dotnet/skills/blob/main/plugins/dotnet-msbuild/skills/build-perf-baseline/SKILL.md

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

使い方

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

貼り付け用メッセージ

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

AIへの頼み方の例

“私の.NETのソリューションが、コールドでビルドされるのと、小さな変更の後にビルドされるのにどれくらい時間がかかるかを計測して、基準にしてください。”

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

仕組み

エージェントは各実行で設定を同じに保ち、各シナリオを何度か繰り返し、サンプルごとにログを保存して、中央値と範囲を報告します。

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

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

Build Performance Baseline & Optimization

Overview

Before optimizing a build, you need a baseline. Without measurements, optimization is guesswork. This skill covers how to establish baselines and apply systematic optimization techniques.

Related skills:

  • build-perf-diagnostics — binlog-based bottleneck identification
  • incremental-build — Inputs/Outputs and up-to-date checks
  • build-parallelism — parallel and graph build tuning
  • eval-performance — glob and import chain optimization

Step 1: Establish a Performance Baseline

Measure three scenarios to understand where time is spent. Keep the SDK, configuration, machine, environment variables, restore state, and build command consistent. Run each scenario at least three times, repeating its setup before every measured sample, and report the median plus the observed range; a single timing is not a baseline. Keep setup outside the timed interval. Save each sample's binlog under a unique name, outside generated output directories.

Cold Build (First Build)

No previous build output exists. Measures the full end-to-end time including restore, compilation, and all targets.

Before every cold sample, restore the same source state, run dotnet clean with the measured configuration, and remove only the confirmed, disposable output and intermediate directories for the measured projects. Include custom artifact paths, not just bin and obj, and obtain approval before deletion. Verify those outputs are absent before timing the next build.

This is an output-cold build, not necessarily a cold NuGet, OS, or compiler server cache. Choose and record a consistent cache/server policy for all samples; do not clear shared caches. If measuring uncached restore, use a separate, empty package cache for each sample.

# After repeating the cold setup; use a unique log name for each sample
dotnet build /bl:cold-build-1.binlog -m

Warm Build (Incremental Build)

Build output exists, some files have changed. Measures how well incremental build works.

Before every warm sample, restore the same baseline source contents and build successfully without timing it. Then apply the same small, build-relevant edit to the same source file and time the build. Keep the changed file set and edit identical across samples; do not let edits accumulate. Restore the baseline contents before the next sample and rebuild them outside the timed interval. Do not clean between that setup build and its measured build.

# Untimed setup after restoring baseline source contents
dotnet build -m

# Apply the same controlled source edit, then measure with a unique log name
dotnet build /bl:warm-build-1.binlog -m

No-Op Build (Nothing Changed)

Build output exists, nothing has changed. Compilation and correctly incremental targets should skip; compare timing with this build's other samples.

Before every no-op sample, restore the same baseline source contents and run an untimed setup build successfully. Then measure an identical build without edits, touching inputs, cleaning outputs, or changing properties. Keep restore and cache/server policy consistent with the other samples.

# Untimed setup after restoring baseline source contents
dotnet build -m

# Rebuild immediately without changes; use a unique log name for each sample
dotnet build /bl:noop-build-1.binlog -m

What Good Looks Like

Scenario Expected Behavior
Cold build Full compilation, all targets run. This is your absolute baseline
Warm build Only changed projects recompile. Time proportional to change scope
No-op build Compilation and correctly incremental custom targets skip; compare duration with this repo's repeated warm and cold samples

Red flags:

  • No-op time is repeatedly close to warm/cold time, or compilation targets rerun → investigate incrementality (see incremental-build)
  • Warm build recompiles everything → project dependency chain forces full rebuild
  • Restore dominates cold samples → measure dotnet restore and dotnet build --no-restore separately before changing project structure

Do not use universal duration or percentage thresholds to declare a bottleneck. Rank costs against the controlled samples and the build's own target/task timings.

Capture analyzer evidence

A binlog shows compiler/task timing, but granular analyzer timing requires an analyzer-reporting run. When su

よくある質問

なぜ各シナリオを何度も実行するのですか?

一回の計測はばらつくため、繰り返しの実行が範囲付きの公正な基準を与えるからです。

コールドのビルドとは何ですか?

以前の出力がない最初のビルドで、復元とすべてのコンパイルを含みます。

遅いビルドを直しますか?

いいえ。まず計測し、原因は診断のスキルが見つけます。

詳細

作者による元の説明

Establish MSBuild/.NET build performance baselines before optimizing. USE FOR: unranked slow builds; cold, warm, incremental or no-op measurements; before/after comparisons; CI output caching; static graph, artifacts output and dependency graph trimming. Start here before build-perf-diagnostics, incremental-build or build-parallelism. DO NOT USE FOR: known repeated-restore fixes (use eliminate-redundant-restores), non-MSBuild builds. For measured target/task/analyzer bottlenecks, use build-perf-diagnostics.

repo: dotnet/skills

人気

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

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

0

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

コメント

  • …

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

似ているスキル