build-perf-baseline
Skill này làm gì
Skill này thiết lập cách đo thời gian build .NET công bằng để có thể chứng minh các cải thiện. Skill dành cho các đội muốn biết build thực sự chậm đến mức nào trước khi thay đổi bất cứ thứ gì.
Khi nào nên dùng
- ✓Khi build .NET chậm và bạn muốn có số liệu đáng tin cậy trước khi thay đổi gì.
- ✓Khi bạn muốn so sánh build trước và sau một thay đổi.
- ✓Khi bạn muốn đo riêng các kịch bản build lạnh, build ấm và build không thay đổi.
Liên kết skill
https://github.com/dotnet/skills/blob/main/plugins/dotnet-msbuild/skills/build-perf-baseline/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Đo xem solution .NET của tôi build lạnh và sau một thay đổi nhỏ mất bao lâu, để chúng tôi có một mốc so sánh.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent giữ thiết lập giống nhau qua các lần chạy, lặp lại từng kịch bản nhiều lần, lưu log cho mỗi mẫu và báo cáo trung vị cùng khoảng dao động.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
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 identificationincremental-build— Inputs/Outputs and up-to-date checksbuild-parallelism— parallel and graph build tuningeval-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 restoreanddotnet build --no-restoreseparately 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
Câu hỏi thường gặp
Vì sao chạy mỗi kịch bản nhiều lần?
Một lần đo có thể nhiễu, nên các lần lặp lại cho mốc công bằng kèm khoảng dao động.
Build lạnh là gì?
Build lạnh là lần build đầu tiên khi chưa có output nào trước đó, bao gồm restore và toàn bộ biên dịch.
Skill có sửa build chậm không?
Không. Skill đo trước, còn skill chẩn đoán sẽ tìm nguyên nhân.
Chi tiết
Mô tả gốc của tác giả
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
Độ phổ biến
- Sao GitHub
- 5.8k
- Vị trí xếp hạng
- #14593
- Giấy phép
- MIT
- Cập nhật
- 2/11/2026
Bình luận
- …
Thêm skill từ kho mã này
create-custom-agent
5.8kGiúp agent của bạn tạo file custom agent cho VS Code, với các tool, hướng dẫn và handoff riêng sang agent khác.
create-skill
5.8kGiúp agent của bạn tạo một agent skill mới với tên hợp lệ, mô tả kích hoạt rõ ràng và file SKILL.md đúng tiêu chuẩn.
csharp-scripts
5.8kGiúp agent của bạn chạy một chương trình C# nhỏ dưới dạng một file duy nhất bằng công cụ dòng lệnh .NET, không cần tạo project đầy đủ.
dotnet-pinvoke
5.8kGiúp agent của bạn gọi các thư viện native C hoặc C++ từ .NET đúng cách, gồm khai báo chữ ký, xử lý chuỗi, bộ nhớ và safe handle.
Skill tương tự
openclaw-update
394kGiúp agent của bạn cập nhật OpenClaw Gateway đang có, chọn cách cập nhật phù hợp với cách cài đặt và giữ phiên làm việc của bạn hoạt động.
diagnose-gateway
394kGiúp agent của bạn tìm hiểu vì sao OpenClaw Gateway bị lỗi bằng cách kiểm tra cài đặt, kênh và cổng mà không thay đổi gì.
crabbox-apps
394kGiúp agent của bạn mở và chạy một app trên máy đám mây tạm thời, rồi hiển thị giao diện của nó trong thanh bên của chat.