[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7D2PBVJ3WZV2771NMMJAF3D":3,"skill-same:01M7D2PBVJ3WZV2771NMMJAF3D":44},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":14,"repositoryHtmlUrl":27,"repositoryHomepageUrl":6,"ownerHtmlUrl":28,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":29,"install":30,"resources":43},"01M7D2PBVJ3WZV2771NMMJAF3D","build-perf-baseline",null,"Establish build performance baselines and apply systematic optimization techniques. USE FOR: diagnosing slow builds, establishing before\u002Fafter measurements (cold, warm, no-op scenarios), applying optimization strategies like static graph builds, artifacts output, and dependency graph trimming. Start here before diving into build-perf-diagnostics, incremental-build, or build-parallelism. DO NOT USE FOR: non-MSBuild build systems, detailed bottleneck analysis (use build-perf-diagnostics after baselining).","itsmejay18\u002FAI-Skills-for-My-Development-Stack","itsmejay18","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F167779943?v=4","01M7CZRFC6DDZA5V2CX8WDSZED","Jay Jemino Ababon ","01M7CZRFCVRNW1SFHSQXEJ3CQN",0,"MIT","https:\u002F\u002Fgithub.com\u002Fitsmejay18\u002FAI-Skills-for-My-Development-Stack\u002Fblob\u002Fmain\u002F20-Performance-Optimization\u002Fbuild-perf-baseline\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: build-perf-baseline\ndescription: \"Establish build performance baselines and apply systematic optimization techniques. USE FOR: diagnosing slow builds, establishing before\u002Fafter measurements (cold, warm, no-op scenarios), applying optimization strategies like static graph builds, artifacts output, and dependency graph trimming. Start here before diving into build-perf-diagnostics, incremental-build, or build-parallelism. DO NOT USE FOR: non-MSBuild build systems, detailed bottleneck analysis (use build-perf-diagnostics after baselining).\"\nlicense: MIT\n---\n\n# Build Performance Baseline & Optimization\n\n## Overview\n\nBefore optimizing a build, you need a **baseline**. Without measurements, optimization is guesswork. This skill covers how to establish baselines and apply systematic optimization techniques.\n\n**Related skills:**\n- `build-perf-diagnostics` — binlog-based bottleneck identification\n- `incremental-build` — Inputs\u002FOutputs and up-to-date checks\n- `build-parallelism` — parallel and graph build tuning\n- `eval-performance` — glob and import chain optimization\n\n---\n\n## Step 1: Establish a Performance Baseline\n\nMeasure three scenarios to understand where time is spent:\n\n### Cold Build (First Build)\n\nNo previous build output exists. Measures the full end-to-end time including restore, compilation, and all targets.\n\n```bash\n# Clean everything first\ndotnet clean\n# Remove bin\u002Fobj to truly start fresh\nGet-ChildItem -Recurse -Directory -Include bin,obj | Remove-Item -Recurse -Force\n# OR on Linux\u002FmacOS:\n# find . -type d \\( -name bin -o -name obj \\) -exec rm -rf {} +\n\n# Measure cold build\ndotnet build \u002Fbl:cold-build.binlog -m\n```\n\n### Warm Build (Incremental Build)\n\nBuild output exists, some files have changed. Measures how well incremental build works.\n\n```bash\n# Build once to populate outputs\ndotnet build -m\n\n# Make a small change (touch one .cs file)\n# Then rebuild\ndotnet build \u002Fbl:warm-build.binlog -m\n```\n\n### No-Op Build (Nothing Changed)\n\nBuild output exists, nothing has changed. This should be nearly instant. If it's slow, incremental build is broken.\n\n```bash\n# Build once to populate outputs\ndotnet build -m\n\n# Rebuild immediately without changes\ndotnet build \u002Fbl:noop-build.binlog -m\n```\n\n### What Good Looks Like\n\n| Scenario | Expected Behavior |\n|----------|------------------|\n| Cold build | Full compilation, all targets run. This is your absolute baseline |\n| Warm build | Only changed projects recompile. Time proportional to change scope |\n| No-op build | \u003C 5 seconds for small repos, \u003C 30 seconds for large repos. All compilation targets should report \"Skipping target — all outputs up-to-date\" |\n\n**Red flags:**\n- No-op build > 30 seconds → incremental build is broken (see `incremental-build` skill)\n- Warm build recompiles everything → project dependency chain forces full rebuild\n- Cold build has long restore → NuGet cache issues\n\n### Recording Baselines\n\nRecord baselines in a structured way before and after optimization:\n\n```\n| Scenario    | Before  | After   | Improvement |\n|-------------|---------|---------|-------------|\n| Cold build  | 2m 15s  |         |             |\n| Warm build  | 1m 40s  |         |             |\n| No-op build | 45s     |         |             |\n```\n\n---\n\n## Step 2: Artifacts Output Layout\n\nThe `UseArtifactsOutput` feature (introduced in .NET 8) changes the output directory structure to avoid bin\u002Fobj clash issues and enable better caching.\n\n### Enabling Artifacts Output\n\n```xml\n\u003C!-- Directory.Build.props -->\n\u003CPropertyGroup>\n  \u003CUseArtifactsOutput>true\u003C\u002FUseArtifactsOutput>\n\u003C\u002FPropertyGroup>\n```\n\n### Before vs After\n\n```\n# Traditional layout (before)\nsrc\u002F\n  MyLib\u002F\n    bin\u002FDebug\u002Fnet8.0\u002FMyLib.dll\n    obj\u002FDebug\u002Fnet8.0\u002F...\n  MyApp\u002F\n    bin\u002FDebug\u002Fnet8.0\u002FMyApp.dll\n\n# Artifacts layout (after)\nartifacts\u002F\n  bin\u002FMyLib\u002Fdebug\u002FMyLib.dll\n  bin\u002FMyApp\u002Fdebug\u002FMyApp.dll\n  obj\u002FMyLib\u002Fdebug\u002F...\n  obj\u002FMyApp\u002Fdebug\u002F...\n```\n\n### Benefits\n\n- **No bin\u002Fobj clash**: Each project+configuration gets a unique path automatically\n- **Easier to cache**: Single `artifacts\u002F` directory to cache\u002Frestore in CI\n- **Cleaner .gitignore**: Just ignore `artifacts\u002F`\n- **Multi-targeting safe**: Each TFM gets its own subdirectory\n\n### Customizing\n\n```xml\n\u003C!-- Change the artifacts root -->\n\u003CPropertyGroup>\n  \u003CArtifactsPath>$(MSBuildThisFileDirectory)output\u003C\u002FArtifactsPath>\n\u003C\u002FPropertyGroup>\n```\n\n---\n\n## Step 3: Deterministic Builds\n\nDeterministic builds produce byte-for-byte identical output given the same inputs. This is essential for build caching and reproducibility.\n\n### Enabling Deterministic Builds\n\n```xml\n\u003C!-- Directory.Build.props -->\n\u003CPropertyGroup>\n  \u003C!-- Enabled by default in .NET SDK projects since SDK 2.0+ -->\n  \u003CDeterministic>true\u003C\u002FDeterministic>\n\n  \u003C!-- For full reproducibility, also set: -->\n  \u003CContinuousIntegrationBuild Condition=\"'$(CI)' == 'true'\">true\u003C\u002FContinuousIntegrationBuild>\n\u003C\u002FPropertyGroup>\n```\n\n### What Deterministic Affects\n\n- Removes timestamps from PE headers\n- Uses consistent file paths in PDBs\n- Produces identical output for identical input\n\n### Why It Matters for Performance\n\n- **Build caching**: If outputs are deterministic, you can cache and reuse them across builds and machines\n- **CI optimization**: Skip rebuilding unchanged projects by comparing inputs\n- **Distributed builds**: Safe to cache compilation results in shared storage\n\n---\n\n## Step 4: Dependency Graph Trimming\n\nReducing unnecessary project references shortens the critical path and reduces what gets built.\n\n### Audit the Dependency Graph\n\n```bash\n# Visualize the dependency graph\ndotnet build \u002Fbl:graph.binlog\n\n# In the binlog, check project references and build times\n# Look for projects that are referenced but could be trimmed\n```\n\n### Techniques\n\n#### Remove Redundant Transitive References\n\n```xml\n\u003C!-- BAD: Utils is already referenced transitively via Core -->\n\u003CItemGroup>\n  \u003CProjectReference Include=\"..\\Core\\Core.csproj\" \u002F>\n  \u003CProjectReference Include=\"..\\Utils\\Utils.csproj\" \u002F>\n\u003C\u002FItemGroup>\n\n\u003C!-- GOOD: Let transitive references flow automatically -->\n\u003CItemGroup>\n  \u003CProjectReference Include=\"..\\Core\\Core.csproj\" \u002F>\n\u003C\u002FItemGroup>\n```\n\n#### Build-Order-Only References\n\nWhen you need a project to build before yours but don't need its assembly output:\n\n```xml\n\u003C!-- Only ensures build order, doesn't reference the output assembly -->\n\u003CProjectReference Include=\"..\\CodeGen\\CodeGen.csproj\"\n                  ReferenceOutputAssembly=\"false\" \u002F>\n```\n\n#### Prevent Transitive Flow\n\nWhen a dependency is an internal implementation detail that shouldn't flow to consumers:\n\n```xml\n\u003C!-- Don't expose this dependency transitively -->\n\u003CProjectReference Include=\"..\\InternalHelpers\\InternalHelpers.csproj\"\n                  PrivateAssets=\"all\" \u002F>\n```\n\n#### Disable Transitive Project References\n\nFor explicit-only dependency management (extreme measure for very large repos):\n\n```xml\n\u003CPropertyGroup>\n  \u003CDisableTransitiveProjectReferences>true\u003C\u002FDisableTransitiveProjectReferences>\n\u003C\u002FPropertyGroup>\n```\n\n**Caution**: This requires all dependencies to be listed explicitly. Only use in large repos where transitive closure is causing excessive rebuilds.\n\n---\n\n## Step 5: Static Graph Builds (`\u002Fgraph`)\n\nStatic graph mode evaluates the entire project graph before building, enabling better scheduling and isolation.\n\n### Enabling Graph Build\n\n```bash\n# Single invocation\ndotnet build \u002Fgraph\n\n# With binary log for analysis\ndotnet build \u002Fgraph \u002Fbl:graph-build.binlog\n```\n\n### Benefits\n\n- **Better parallelism**: MSBuild knows the full graph upfront and can schedule optimally\n- **Build isolation**: Each project builds in isolation (no cross-project state leakage)\n- **Caching potential**: With isolation, individual project results can be cached\n\n### When to Use\n\n| Scenario | Recommendation |\n|----------|---------------|\n| Large multi-project solution (20+ projects) | ✅ Try `\u002Fgraph` — may see significant parallelism gains |\n| Small solution (\u003C 5 projects) | ❌ Overhead of graph evaluation outweighs benefits |\n| CI builds | ✅ Graph builds are more predictable and parallelizable |\n| Local development | ⚠️ Test both — may or may not help depending on project structure |\n\n### Troubleshooting Graph Build\n\nGraph build requires that all `ProjectReference` items are statically determinable (no dynamic references computed in targets). If graph build fails:\n\n```\nerror MSB4260: Project reference \"...\" could not be resolved with static graph.\n```\n\n**Fix**: Ensure all `ProjectReference` items are declared in `\u003CItemGroup>` outside of targets (not dynamically computed inside `\u003CTarget>` blocks).\n\n---\n\n## Step 6: Parallel Build Tuning\n\n### MaxCpuCount\n\n```bash\n# Use all available cores (default in dotnet build)\ndotnet build -m\n\n# Specify explicit core count (useful for CI with shared agents)\ndotnet build -m:4\n\n# MSBuild.exe syntax\nmsbuild \u002Fm:8 MySolution.sln\n```\n\n### Identifying Parallelism Bottlenecks\n\nIn a binlog, look for:\n- **Long sequential chains**: Projects that must build one after another due to dependencies\n- **Uneven load**: Some build nodes idle while others are overloaded\n- **Single-project bottleneck**: One large project on the critical path that blocks everything\n\nUse `grep 'Target Performance Summary' -A 30 full.log` in binlog analysis to see build node utilization.\n\n### Reducing the Critical Path\n\nThe critical path is the longest chain of dependent projects. To shorten it:\n\n1. **Break large projects into smaller ones** that can build in parallel\n2. **Remove unnecessary ProjectReferences** (see Step 5)\n3. **Use `ReferenceOutputAssembly=\"false\"`** for build-order-only dependencies\n4. **Move shared code to a base library** that builds first, then parallelize consumers\n\n---\n\n## Step 7: Additional Quick Wins\n\n### Separate Restore from Build\n\n```bash\n# In CI, restore once then build without restore\ndotnet restore\ndotnet build --no-restore -m\ndotnet test --no-build\n```\n\n### Skip Unnecessary Targets\n\n```bash\n# Skip building documentation\ndotnet build \u002Fp:GenerateDocumentationFile=false\n\n# Skip analyzers during development (not for CI!)\ndotnet build \u002Fp:RunAnalyzers=false\n```\n\n### Use Project-Level Filtering\n\n```bash\n# Build only the project you're working on (and its dependencies)\ndotnet build src\u002FMyApp\u002FMyApp.csproj\n\n# Don't build the entire solution if you only need one project\n```\n\n### Binary Log for All Investigations\n\nAlways start with a binlog:\n```bash\ndotnet build \u002Fbl:perf.binlog -m\n```\n\nThen use the `build-perf-diagnostics` skill and binlog tools for systematic bottleneck identification.\n\n---\n\n## Optimization Decision Tree\n\n```\nIs your no-op build slow (> 10s per project)?\n├── YES → See `incremental-build` skill (fix Inputs\u002FOutputs)\n└── NO\n    Is your cold build slow?\n    ├── YES\n    │   Is restore slow?\n    │   ├── YES → Optimize NuGet restore (use lock files, configure local cache)\n    │   └── NO\n    │       Is compilation slow?\n    │       ├── YES\n    │       │   Are analyzers\u002Fgenerators slow?\n    │       │   ├── YES → See `build-perf-diagnostics` skill\n    │       │   └── NO → Check parallelism, graph build, critical path (this skill + `build-parallelism`)\n    │       └── NO → Check custom targets (binlog analysis via `build-perf-diagnostics`)\n    └── NO\n        Is your warm build slow?\n        ├── YES → Projects rebuilding unnecessarily → check `incremental-build` skill\n        └── NO → Build is healthy! Consider graph build or UseArtifactsOutput for further gains\n```\n","# Build Performance Baseline & Optimization\n\n## Overview\n\nBefore optimizing a build, you need a **baseline**. Without measurements, optimization is guesswork. This skill covers how to establish baselines and apply systematic optimization techniques.\n\n**Related skills:**\n- `build-perf-diagnostics` — binlog-based bottleneck identification\n- `incremental-build` — Inputs\u002FOutputs and up-to-date checks\n- `build-parallelism` — parallel and graph build tuning\n- `eval-performance` — glob and import chain optimization\n\n---\n\n## Step 1: Establish a Performance Baseline\n\nMeasure three scenarios to understand where time is spent:\n\n### Cold Build (First Build)\n\nNo previous build output exists. Measures the full end-to-end time including restore, compilation, and all targets.\n\n```bash\n# Clean everything first\ndotnet clean\n# Remove bin\u002Fobj to truly start fresh\nGet-ChildItem -Recurse -Directory -Include bin,obj | Remove-Item -Recurse -Force\n# OR on Linux\u002FmacOS:\n# find . -type d \\( -name bin -o -name obj \\) -exec rm -rf {} +\n\n# Measure cold build\ndotnet build \u002Fbl:cold-build.binlog -m\n```\n\n### Warm Build (Incremental Build)\n\nBuild output exists, some files have changed. Measures how well incremental build works.\n\n```bash\n# Build once to populate outputs\ndotnet build -m\n\n# Make a small change (touch one .cs file)\n# Then rebuild\ndotnet build \u002Fbl:warm-build.binlog -m\n```\n\n### No-Op Build (Nothing Changed)\n\nBuild output exists, nothing has changed. This should be nearly instant. If it's slow, incremental build is broken.\n\n```bash\n# Build once to populate outputs\ndotnet build -m\n\n# Rebuild immediately without changes\ndotnet build \u002Fbl:noop-build.binlog -m\n```\n\n### What Good Looks Like\n\n| Scenario | Expected Behavior |\n|----------|------------------|\n| Cold build | Full compilation, all targets run. This is your absolute baseline |\n| Warm build | Only changed projects recompile. Time proportional to change scope |\n| No-op build | \u003C 5 seconds for small repos, \u003C 30 seconds for large repos. All compilation targets should report \"Skipping target — all outputs up-to-date\" |\n\n**Red flags:**\n- No-op build > 30 seconds → incremental build is broken (see `incremental-build` skill)\n- Warm build recompiles everything → project dependency chain forces full rebuild\n- Cold build has long restore → NuGet cache issues\n\n### Recording Baselines\n\nRecord baselines in a structured way before and after optimization:\n\n```\n| Scenario    | Before  | After   | Improvement |\n|-------------|---------|---------|-------------|\n| Cold build  | 2m 15s  |         |             |\n| Warm build  | 1m 40s  |         |             |\n| No-op build | 45s     |         |             |\n```\n\n---\n\n## Step 2: Artifacts Output Layout\n\nThe `UseArtifactsOutput` feature (introduced in .NET 8) changes the output directory structure to avoid bin\u002Fobj clash issues and enable better caching.\n\n### Enabling Artifacts Output\n\n```xml\n\u003C!-- Directory.Build.props -->\n\u003CPropertyGroup>\n  \u003CUseArtifactsOutput>true\u003C\u002FUseArtifactsOutput>\n\u003C\u002FPropertyGroup>\n```\n\n### Before vs After\n\n```\n# Traditional layout (before)\nsrc\u002F\n  MyLib\u002F\n    bin\u002FDebug\u002Fnet8.0\u002FMyLib.dll\n    obj\u002FDebug\u002Fnet8.0\u002F...\n  MyApp\u002F\n    bin\u002FDebug\u002Fnet8.0\u002FMyApp.dll\n\n# Artifacts layout (after)\nartifacts\u002F\n  bin\u002FMyLib\u002Fdebug\u002FMyLib.dll\n  bin\u002FMyApp\u002Fdebug\u002FMyApp.dll\n  obj\u002FMyLib\u002Fdebug\u002F...\n  obj\u002FMyApp\u002Fdebug\u002F...\n```\n\n### Benefits\n\n- **No bin\u002Fobj clash**: Each project+configuration gets a unique path automatically\n- **Easier to cache**: Single `artifacts\u002F` directory to cache\u002Frestore in CI\n- **Cleaner .gitignore**: Just ignore `artifacts\u002F`\n- **Multi-targeting safe**: Each TFM gets its own subdirectory\n\n### Customizing\n\n```xml\n\u003C!-- Change the artifacts root -->\n\u003CPropertyGroup>\n  \u003CArtifactsPath>$(MSBuildThisFileDirectory)output\u003C\u002FArtifactsPath>\n\u003C\u002FPropertyGroup>\n```\n\n---\n\n## Step 3: Deterministic Builds\n\nDeterministic builds produce byte-for-byte identical output given the same inputs. This is essential for build caching and reproducibility.\n\n### Enabling Deterministic Builds\n\n```xml\n\u003C!-- Directory.Build.props -->\n\u003CPropertyGroup>\n  \u003C!-- Enabled by default in .NET SDK projects since SDK 2.0+ -->\n  \u003CDeterministic>true\u003C\u002FDeterministic>\n\n  \u003C!-- For full reproducibility, also set: -->\n  \u003CContinuousIntegrationBuild Condition=\"'$(CI)' == 'true'\">true\u003C\u002FContinuousIntegrationBuild>\n\u003C\u002FPropertyGroup>\n```\n\n### What Deterministic Affects\n\n- Removes timestamps from PE headers\n- Uses consistent file paths in PDBs\n- Produces identical output for identical input\n\n### Why It Matters for Performance\n\n- **Build caching**: If outputs are deterministic, you can cache and reuse them across builds and machines\n- **CI optimization**: Skip rebuilding unchanged projects by comparing inputs\n- **Distributed builds**: Safe to cache compilation results in shared storage\n\n---\n\n## Step 4: Dependency Graph Trimming\n\nReducing unnecessary project references shortens the critical path and reduces what gets built.\n\n### Audit the Dependency Graph\n\n```bash\n# Visualize the dependency graph\ndotnet build \u002Fbl:graph.binlog\n\n# In the binlog, check project references and build times\n# Look for projects that are referenced but could be trimmed\n```\n\n### Techniques\n\n#### Remove Redundant Transitive References\n\n```xml\n\u003C!-- BAD: Utils is already referenced transitively via Core -->\n\u003CItemGroup>\n  \u003CProjectReference Include=\"..\\Core\\Core.csproj\" \u002F>\n  \u003CProjectReference Include=\"..\\Utils\\Utils.csproj\" \u002F>\n\u003C\u002FItemGroup>\n\n\u003C!-- GOOD: Let transitive references flow automatically -->\n\u003CItemGroup>\n  \u003CProjectReference Include=\"..\\Core\\Core.csproj\" \u002F>\n\u003C\u002FItemGroup>\n```\n\n#### Build-Order-Only References\n\nWhen you need a project to build before yours but don't need its assembly output:\n\n```xml\n\u003C!-- Only ensures build order, doesn't reference the output assembly -->\n\u003CProjectReference Include=\"..\\CodeGen\\CodeGen.csproj\"\n                  ReferenceOutputAssembly=\"false\" \u002F>\n```\n\n#### Prevent Transitive Flow\n\nWhen a dependency is an internal implementation detail that shouldn't flow to consumers:\n\n```xml\n\u003C!-- Don't expose this dependency transitively -->\n\u003CProjectReference Include=\"..\\InternalHelpers\\InternalHelpers.csproj\"\n                  PrivateAssets=\"all\" \u002F>\n```\n\n#### Disable Transitive Project References\n\nFor explicit-only dependency management (extreme measure for very large repos):\n\n```xml\n\u003CPropertyGroup>\n  \u003CDisableTransitiveProjectReferences>true\u003C\u002FDisableTransitiveProjectReferences>\n\u003C\u002FPropertyGroup>\n```\n\n**Caution**: This requires all dependencies to be listed explicitly. Only use in large repos where transitive closure is causing excessive rebuilds.\n\n---\n\n## Step 5: Static Graph Builds (`\u002Fgraph`)\n\nStatic graph mode evaluates the entire project graph before building, enabling better scheduling and isolation.\n\n### Enabling Graph Build\n\n```bash\n# Single invocation\ndotnet build \u002Fgraph\n\n# With binary log for analysis\ndotnet build \u002Fgraph \u002Fbl:graph-build.binlog\n```\n\n### Benefits\n\n- **Better parallelism**: MSBuild knows the full graph upfront and can schedule optimally\n- **Build isolation**: Each project builds in isolation (no cross-project state leakage)\n- **Caching potential**: With isolation, individual project results can be cached\n\n### When to Use\n\n| Scenario | Recommendation |\n|----------|---------------|\n| Large multi-project solution (20+ projects) | ✅ Try `\u002Fgraph` — may see significant parallelism gains |\n| Small solution (\u003C 5 projects) | ❌ Overhead of graph evaluation outweighs benefits |\n| CI builds | ✅ Graph builds are more predictable and parallelizable |\n| Local development | ⚠️ Test both — may or may not help depending on project structure |\n\n### Troubleshooting Graph Build\n\nGraph build requires that all `ProjectReference` items are statically determinable (no dynamic references computed in targets). If graph build fails:\n\n```\nerror MSB4260: Project reference \"...\" could not be resolved with static graph.\n```\n\n**Fix**: Ensure all `ProjectReference` items are declared in `\u003CItemGroup>` outside of targets (not dynamically computed inside `\u003CTarget>` blocks).\n\n---\n\n## Step 6: Parallel Build Tuning\n\n### MaxCpuCount\n\n```bash\n# Use all available cores (default in dotnet build)\ndotnet build -m\n\n# Specify explicit core count (useful for CI with shared agents)\ndotnet build -m:4\n\n# MSBuild.exe syntax\nmsbuild \u002Fm:8 MySolution.sln\n```\n\n### Identifying Parallelism Bottlenecks\n\nIn a binlog, look for:\n- **Long sequential chains**: Projects that must build one after another due to dependencies\n- **Uneven load**: Some build nodes idle while others are overloaded\n- **Single-project bottleneck**: One large project on the critical path that blocks everything\n\nUse `grep 'Target Performance Summary' -A 30 full.log` in binlog analysis to see build node utilization.\n\n### Reducing the Critical Path\n\nThe critical path is the longest chain of dependent projects. To shorten it:\n\n1. **Break large projects into smaller ones** that can build in parallel\n2. **Remove unnecessary ProjectReferences** (see Step 5)\n3. **Use `ReferenceOutputAssembly=\"false\"`** for build-order-only dependencies\n4. **Move shared code to a base library** that builds first, then parallelize consumers\n\n---\n\n## Step 7: Additional Quick Wins\n\n### Separate Restore from Build\n\n```bash\n# In CI, restore once then build without restore\ndotnet restore\ndotnet build --no-restore -m\ndotnet test --no-build\n```\n\n### Skip Unnecessary Targets\n\n```bash\n# Skip building documentation\ndotnet build \u002Fp:GenerateDocumentationFile=false\n\n# Skip analyzers during development (not for CI!)\ndotnet build \u002Fp:RunAnalyzers=false\n```\n\n### Use Project-Level Filtering\n\n```bash\n# Build only the project you're working on (and its dependencies)\ndotnet build src\u002FMyApp\u002FMyApp.csproj\n\n# Don't build the entire solution if you only need one project\n```\n\n### Binary Log for All Investigations\n\nAlways start with a binlog:\n```bash\ndotnet build \u002Fbl:perf.binlog -m\n```\n\nThen use the `build-perf-diagnostics` skill and binlog tools for systematic bottleneck identification.\n\n---\n\n## Optimization Decision Tree\n\n```\nIs your no-op build slow (> 10s per project)?\n├── YES → See `incremental-build` skill (fix Inputs\u002FOutputs)\n└── NO\n    Is your cold build slow?\n    ├── YES\n    │   Is restore slow?\n    │   ├── YES → Optimize NuGet restore (use lock files, configure local cache)\n    │   └── NO\n    │       Is compilation slow?\n    │       ├── YES\n    │       │   Are analyzers\u002Fgenerators slow?\n    │       │   ├── YES → See `build-perf-diagnostics` skill\n    │       │   └── NO → Check parallelism, graph build, critical path (this skill + `build-parallelism`)\n    │       └── NO → Check custom targets (binlog analysis via `build-perf-diagnostics`)\n    └── NO\n        Is your warm build slow?\n        ├── YES → Projects rebuilding unnecessarily → check `incremental-build` skill\n        └── NO → Build is healthy! Consider graph build or UseArtifactsOutput for further gains\n```\n",{"name":5,"license":15,"description":7},"main","30954af1dcd1a74b63f05deb2e2c41e5ecae4a82","20-Performance-Optimization\u002Fbuild-perf-baseline","https:\u002F\u002Fgithub.com\u002Fitsmejay18\u002FAI-Skills-for-My-Development-Stack","https:\u002F\u002Fgithub.com\u002Fitsmejay18","2026-09-18 16:06:36",{"source":8,"skillName":5,"commands":31,"prompt":41,"zipAvailable":42},[32,35,38],{"tool":33,"command":34},"npx","npx skills add itsmejay18\u002FAI-Skills-for-My-Development-Stack --skill build-perf-baseline",{"tool":36,"command":37},"bunx","bunx skills add itsmejay18\u002FAI-Skills-for-My-Development-Stack --skill build-perf-baseline",{"tool":39,"command":40},"pnpm","pnpm dlx skills add itsmejay18\u002FAI-Skills-for-My-Development-Stack --skill build-perf-baseline","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fitsmejay18\u002FAI-Skills-for-My-Development-Stack\u002Fblob\u002Fmain\u002F20-Performance-Optimization\u002Fbuild-perf-baseline\u002FSKILL.md",true,[],[45,52,59,66,73,80],{"skillNo":46,"name":47,"nameZh":6,"description":48,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":49,"categories":50,"keywords":51,"publishedAt":19},"01M7D2RKBHPZ3E1RNN5DWHT550","vectorization","Design, implement, optimize, and review SIMD code in .NET. USE FOR: vectorizing scalar loops with TensorPrimitives, Vector64\u002F128\u002F256\u002F512, or platform hardware intrinsics; reviewing existing SIMD code, including Vector\u003CT>, for contract equivalence, tail handling, memory safety, portability, fallbacks, and measured performance. DO NOT USE FOR: performance work unrelated to SIMD or vectorization.","https:\u002F\u002Fgithub.com\u002Fitsmejay18\u002FAI-Skills-for-My-Development-Stack\u002Fblob\u002Fmain\u002F20-Performance-Optimization\u002Fvectorization\u002FSKILL.md",[],[],{"skillNo":53,"name":54,"nameZh":6,"description":55,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":56,"categories":57,"keywords":58,"publishedAt":19},"01M7D2RDJ7RN3QK8GJR0QTER1D","resolve-project-references","Guide for interpreting ResolveProjectReferences time in MSBuild performance summaries. Activate when ResolveProjectReferences appears as the most expensive target and developers are trying to optimize it directly. Explains that the reported time includes wait time for dependent project builds and is misleading. Guides users to focus on task self-time instead. Do not activate for general build performance -- use build-perf-diagnostics instead.","https:\u002F\u002Fgithub.com\u002Fitsmejay18\u002FAI-Skills-for-My-Development-Stack\u002Fblob\u002Fmain\u002F20-Performance-Optimization\u002Fresolve-project-references\u002FSKILL.md",[],[],{"skillNo":60,"name":61,"nameZh":6,"description":62,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":63,"categories":64,"keywords":65,"publishedAt":19},"01M7D2R1H2GTNZYHG9YRX3JDQW","optimizing-ef-core-queries","Optimize and improve the performance of slow Entity Framework Core (EF Core) queries: make them generate less SQL, make fewer database round-trips, and return results faster. Use whenever an EF Core or DbContext query or data-access path is slow or should be made faster — whether or not EF Core owns the database schema. For EF Core, not Dapper or raw ADO.NET.","https:\u002F\u002Fgithub.com\u002Fitsmejay18\u002FAI-Skills-for-My-Development-Stack\u002Fblob\u002Fmain\u002F20-Performance-Optimization\u002Foptimizing-ef-core-queries\u002FSKILL.md",[],[],{"skillNo":67,"name":68,"nameZh":6,"description":69,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":70,"categories":71,"keywords":72,"publishedAt":19},"01M7D2QREG04W1YT0NEBHEW5C9","microbenchmarking","Activate this skill when BenchmarkDotNet (BDN) is involved in the task — creating, running, configuring, or reviewing BDN benchmarks. Also activate when microbenchmarking .NET code would be useful and BenchmarkDotNet is the likely tool. Consider activating when answering a .NET performance question requires measurement and BenchmarkDotNet may be needed. Covers microbenchmark design, BDN configuration and project setup, how to run BDN microbenchmarks efficiently and effectively, and using BDN for side-by-side performance comparisons. Do NOT use for profiling\u002Ftracing .NET code (dotnet-trace, PerfView), production telemetry, or load\u002Fstress testing (Crank, k6).","https:\u002F\u002Fgithub.com\u002Fitsmejay18\u002FAI-Skills-for-My-Development-Stack\u002Fblob\u002Fmain\u002F20-Performance-Optimization\u002Fmicrobenchmarking\u002FSKILL.md",[],[],{"skillNo":74,"name":75,"nameZh":6,"description":76,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":19},"01M7D2QGE175XWPZVACVH2868Z","incremental-build","Guide for optimizing MSBuild incremental builds. USE FOR: builds slower than expected on subsequent runs, 'nothing changed but it rebuilds anyway', diagnosing why targets re-execute unnecessarily, fixing broken no-op builds. Covers 8 common causes: missing Inputs\u002FOutputs on custom targets, volatile properties in output paths (timestamps\u002FGUIDs), file writes outside tracked Outputs, missing FileWrites registration, glob changes, Visual Studio Fast Up-to-Date Check (FUTDC) issues. Key diagnostic: look for 'Building target completely' vs 'Skipping target' in binlog. DO NOT USE FOR: first-time build slowness (use build-perf-baseline), parallelism issues (use build-parallelism), evaluation-phase slowness (use eval-performance), non-MSBuild build systems.","https:\u002F\u002Fgithub.com\u002Fitsmejay18\u002FAI-Skills-for-My-Development-Stack\u002Fblob\u002Fmain\u002F20-Performance-Optimization\u002Fincremental-build\u002FSKILL.md",[],[],{"skillNo":81,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":84,"categories":85,"keywords":86,"publishedAt":19},"01M7D2Q1DQTC6K49R73WQTTPSB","eval-performance","Guide for diagnosing and improving MSBuild project evaluation performance. USE FOR: builds slow before any compilation starts, high evaluation time in binlog analysis, expensive glob patterns walking large directories (node_modules, .git, bin\u002Fobj), deep import chains (>20 levels), preprocessed output >10K lines indicating heavy evaluation, property functions with file I\u002FO ($([System.IO.File]::ReadAllText(...))), multiple evaluations per project. Covers the 5 MSBuild evaluation phases, glob optimization via DefaultItemExcludes, import chain analysis with \u002Fpp preprocessing. DO NOT USE FOR: compilation-time slowness (use build-perf-diagnostics), incremental build issues (use incremental-build), non-MSBuild build systems.","https:\u002F\u002Fgithub.com\u002Fitsmejay18\u002FAI-Skills-for-My-Development-Stack\u002Fblob\u002Fmain\u002F20-Performance-Optimization\u002Feval-performance\u002FSKILL.md",[],[]]