bazelbuild / bazelbuild/bazel

Quickly compute downstream dependency count per target

Open
#19,234 6 comments 1 reaction 1 assignee Assigned to @zhengwei143 View on GitHub
not stale P3 team-Performance type: feature request
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 18h
Merged PRs (30d)
75

Description

### Description of the feature request:

`minrank` and `maxrank` can be calculated for each target through a single command:
```
bazel query //... --output=minrank
bazel query //... --output=maxrank
```

However, calculating the downstream dependency count for each target, requires calling bazel many times:
```
bazel query 'rdeps(//..., )' | wc -l
bazel query 'rdeps(//..., )' | wc -l
bazel query 'rdeps(//..., )' | wc -l
...
```

Can it be done more efficiently?
Could a new `--output` type solve this?

I'm wondering what others think, and if there is a faster way to get these counts.
Since bazel is doing a topological sort, I'm hoping these counts could be exposed more efficiently.
My current approach is to dump the analysis cache, and run my own graph traversal to get these numbers.

### Which category does this issue belong to?

CLI, Performance

### What underlying problem are you trying to solve with this feature?

Get the downstream dependency count for every target as fast and efficiently as possible.

### Which operating system are you running Bazel on?

Linux

### What is the output of `bazel info release`?

release 6.2.0

### If `bazel info release` returns `development version` or `(@non-git)`, tell us how you built Bazel.

_No response_

### What's the output of `git remote get-url origin; git rev-parse master; git rev-parse HEAD` ?

```text
Not relevant.
```

### Have you found anything relevant by searching the web?

No

### Any other information, logs, or outputs that you want to share?

Not relevant.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.