Everytime after a build is done, I see something like:
Elapsed time: 1034.748s, Critical Path: 257.54s
Wondering what's the difference between Elapsed Time and Critical Path? What can be causing the time difference?
Forwarded from: https://github.com/bazelbuild/bazel/issues/3164
Bazel build process When running a build or a test, Bazel does the following: Loads the BUILD files relevant to the target. Analyzes the inputs and their dependencies, applies the specified build rules, and produces an action graph. Executes the build actions on the inputs until the final build outputs are produced.
A rule defines a series of actions that Bazel performs on inputs to produce a set of outputs, which are referenced in providers returned by the rule's implementation function.
To do so, bazel caches all files downloaded in the repository cache which, by default, is located at ~/. cache/bazel/_bazel_$USER/cache/repos/v1/ . The location can be changed by the --repository_cache option. The cache is shared between all workspaces and installed versions of bazel.
"Elapsed time" shows the wall time of the build, since Bazel started running the first build action until the last action finished.
"Critical path" shows the wall time spent building the longest chain of actions, where each subsequent action depends on the output(s) of the previous one, so they must be run sequentially. The critical path is a lower limit on the clean build time of this build; even if the CPU had more cores than the number of actions Bazel ever runs in parallel, the build could still not complete any faster.
The time difference is caused by Bazel executing other actions too. There were presumably more actions to run than just those on the critical path.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With