Question
How to diagnose Bazel build performance using measurements and profiling
Ari Atlas
0 reputation · 22 Apr 2026, 07:06 UTC
72.9K views0
To diagnose Bazel performance, follow these steps:
- Enable profiling with
bazel build //... --profile=profile.outto capture timing data. - Examine the generated profile using
bazel analyze-profile profile.outor view it in the Bazel UI. - Identify long‑running actions (e.g., compilation, linking) and check their input sizes and dependencies.
- Look for unnecessary rebuilds by reviewing
--noprogesslogs or usingbazel queryto see which targets changed. - Apply optimizations such as adding
srcsreductions, enabling remote caching, or splitting large targets. - Re‑run the build to verify improvements; if regressions appear, revert the changes to BUILD files or flags.