resolve-project-references

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Misleading ResolveProjectReferences Time

容易造成误导的ResolveProjectReferences耗时

Prevent misguided optimization of
ResolveProjectReferences
by explaining that its reported time is wall-clock wait time, not CPU work.
通过说明
ResolveProjectReferences
上报的耗时是挂钟等待时间而非CPU工作量,避免对该目标进行错误的优化。

When to Use

适用场景

  • ResolveProjectReferences
    appears as the most expensive target in the Target Performance Summary
  • A developer is trying to optimize
    ResolveProjectReferences
    directly
  • Build performance analysis shows a single target consuming 50-80% of total build time
  • ResolveProjectReferences
    在目标性能摘要(Target Performance Summary)中显示为开销最高的目标
  • 开发者正尝试直接优化
    ResolveProjectReferences
  • 构建性能分析显示单个目标占用了总构建时间的50-80%

When Not to Use

不适用场景

  • General build performance optimization (use
    build-perf-diagnostics
    instead)
  • The bottleneck is clearly a different target (e.g.,
    Csc
    ,
    ResolveAssemblyReference
    )
  • The user has not yet captured a binlog or performance summary
  • 通用构建性能优化(请改用
    build-perf-diagnostics
  • 瓶颈明显是其他目标(例如
    Csc
    ResolveAssemblyReference
  • 用户尚未捕获binlog或性能摘要

Inputs

输入项

InputRequiredDescription
Build log or binlogYesA diagnostic build log or binlog containing the Target Performance Summary
输入项必填说明
构建日志或binlog包含目标性能摘要的诊断级构建日志或binlog

Workflow

工作流程

Step 1: Confirm the misleading symptom

步骤1:确认误导性症状

Verify that
ResolveProjectReferences
appears as the top target in the Target Performance Summary. This is the misleading metric.
核实
ResolveProjectReferences
目标性能摘要中排在首位,该指标存在误导性。

Step 2: Explain why it is misleading

步骤2:解释误导性的原因

The reported time includes waiting for dependent projects to build while the MSBuild node is yielded (see dotnet/msbuild#3135). During this wait, the node may be doing useful work on other projects. The target itself does very little work.
上报的耗时包含MSBuild节点让出时等待依赖项目构建的时间(参考dotnet/msbuild#3135)。在等待期间,该节点可能在处理其他项目的有效工作,该目标本身实际执行的工作量极少。

Step 3: Redirect to task self-time

步骤3:引导关注任务自身耗时

Guide the user to use the Task Performance Summary instead:
bash
dotnet msbuild build.binlog -noconlog -fl "-flp:v=diag;logfile=full.log;performancesummary"
grep "Task Performance Summary" -A 50 full.log
Focus on self-time of actual tasks:
  • Csc: see
    build-perf-diagnostics
    skill (Section 2: Roslyn Analyzers)
  • ResolveAssemblyReference: see
    build-perf-diagnostics
    skill (Section 1: RAR)
  • Copy: see
    build-perf-diagnostics
    skill (Section 4: File I/O)
  • Serialization bottlenecks: see
    build-parallelism
    skill
引导用户转而使用任务性能摘要(Task Performance Summary)
bash
dotnet msbuild build.binlog -noconlog -fl "-flp:v=diag;logfile=full.log;performancesummary"
grep "Task Performance Summary" -A 50 full.log
聚焦实际任务的自身耗时:
  • Csc:参考
    build-perf-diagnostics
    技能(第2节:Roslyn分析器)
  • ResolveAssemblyReference:参考
    build-perf-diagnostics
    技能(第1节:RAR)
  • Copy:参考
    build-perf-diagnostics
    技能(第4节:文件I/O)
  • 序列化瓶颈:参考
    build-parallelism
    技能

Validation

校验项

  • Task Performance Summary was used instead of Target Performance Summary
  • ResolveProjectReferences
    was not set as the optimization target
  • A concrete task (e.g.,
    Csc
    ,
    Copy
    ,
    ResolveAssemblyReference
    ) was identified as the true bottleneck
  • 已使用任务性能摘要替代目标性能摘要
  • 未将
    ResolveProjectReferences
    设为优化目标
  • 已识别出具体任务(例如
    Csc
    Copy
    ResolveAssemblyReference
    )作为真正的瓶颈