← Workflows

阅读中文版本

Build Time Reduction Workflow

Profile where build time goes, parallelize independent work, cache expensive steps, and drop unnecessary work so CI feedback gets fast.

intermediate~120 minciperformancedx

Objective

Cut CI build time with measurement-driven optimizations rather than guesswork.

Environment

  • Build timing data per step
  • A cache and parallelism-capable CI

Steps

1. Measure time per step to find

Measure time per step to find the top contributors.

Expected state: Optimization targets the real bottlenecks.

2. Parallelize steps that do not depend

Parallelize steps that do not depend on each other.

Expected state: Wall-clock time drops.

3. Cache dependencies and build outputs

Cache dependencies and build outputs with correct keys.

Expected state: Repeat work is avoided.

4. Remove or defer work that does

Remove or defer work that does not add value on every commit.

Expected state: Only necessary work runs.

Decision points

Optimize the biggest step or many small ones?

  • Biggest first
  • Everything

Attack the top contributor first; small wins on many steps rarely move wall-clock time.

Cache aggressively or conservatively?

  • Correct keys
  • Aggressive

Correct cache keys; aggressive caching with wrong keys serves stale results.

Expected outcome

A measurably faster CI pipeline with the top time contributors addressed and caching effective.

Verification

Confirm the measured build time dropped and that no test or check coverage was lost in the change.

Cleanup

Record before and after timings and keep the cache keys documented.

Overview

Cut CI build time with measurement-driven optimizations rather than guesswork. Confirm the measured build time dropped and that no test or check coverage was lost in the change.

Steps

  1. Measure time per step to find the top contributors. Expected state: Optimization targets the real bottlenecks.
  2. Parallelize steps that do not depend on each other. Expected state: Wall-clock time drops.
  3. Cache dependencies and build outputs with correct keys. Expected state: Repeat work is avoided.
  4. Remove or defer work that does not add value on every commit. Expected state: Only necessary work runs.
# report the slowest steps
awk '{print $2}' timing.log | sort -nr | head
# then parallelize or cache those

Verification

  • A measurably faster CI pipeline with the top time contributors addressed and caching effective.

Decision points

  • Optimize the biggest step or many small ones? Options: Biggest first; Everything. Recommended: Attack the top contributor first; small wins on many steps rarely move wall-clock time.
  • Cache aggressively or conservatively? Options: Correct keys; Aggressive. Recommended: Correct cache keys; aggressive caching with wrong keys serves stale results.