bazelbuild / bazelbuild/bazel

Bazel binary size increase

Open
#22,722 2 comments 0 reactions 0 assignees View on GitHub
P2 team-OSS type: bug
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 20h
Merged PRs (30d)
72

Description

### Description of the bug:

Background: We had a project to reduce bazel binary size a couple years ago (https://docs.google.com/document/d/1Igmv-2GfXkoVFWTXvBYPeniQom8nLAwzqzridDlBIS4/edit#heading=h.lk6ehhcngo7) which ended up ~42MB with Bazel 2.1.0.

Now, I realized that Bazel 7.2.0 is almost 70MB large.

I did some investigation and found the following changes that increased the binary size by more than 0.5MB:

- 1.68MB | https://github.com/bazelbuild/bazel/commit/7025bb88432d53bb7c05c813a99522cba5e1ace0
- 1.21MB | https://github.com/bazelbuild/bazel/commit/2330a1116f98bee08aaf9ed04b55505e14a9baee
- 0.53MB | https://github.com/bazelbuild/bazel/commit/8ef7b705bb33de6ee9025c01bdf65a23f73926e3
- 10.02MB | https://github.com/bazelbuild/bazel/commit/de87119a7257220a2872ad5c91164caf37d3f8e2
- 1.45MB | https://github.com/bazelbuild/bazel/commit/c9edba39787cfd1aaa7e483d468fa8af598a4a2f
- 0.69MB | https://github.com/bazelbuild/bazel/commit/ecf9b9a82aa231cd1fa9178dd9ab64dd67adaf25
- 0.53MB | https://github.com/bazelbuild/bazel/commit/5cbb153c839f13c07d777a0175e88dc8a1ab2780
- 1.21MB | https://github.com/bazelbuild/bazel/commit/b1183e792aaac2b5eec68ccc0a9bcd7478b1e14e
- 0.73MB | https://github.com/bazelbuild/bazel/commit/1596ae62782196b8e4cedf943c4dd53a82158eab
- 0.92MB | https://github.com/bazelbuild/bazel/commit/e58785c58ecf9287a97e07c0d6199dfbc969557a
- 1.17MB | https://github.com/bazelbuild/bazel/commit/affc27f9d18f9781437e91a3f36c73962a56f261
- 1.33MB | https://github.com/bazelbuild/bazel/commit/de8f69dd9ef2e06d2809a2ae3eedc97810e0d181
- 1.02MB | https://github.com/bazelbuild/bazel/commit/a74096f4523edd8bf600b74e51996bc22981df0b
- 1.01MB | https://github.com/bazelbuild/bazel/commit/75d4b8cb406b392d08bd224ccc572747c10b50da

(As we didn't have a Bazel binary at every commit, the actual culprit might be a culprit of the identified commit.)

Most of these seem to be 3rd party deps upgrades, we might want to see which deps are easy to cut or have unnecessary files in them.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the reported Bazel 2.1.0 and 7.2.0 binary-size comparison, then inspect the listed commits and their third-party dependency upgrades. Done means identifying the causes of the increase and determining which dependencies or files can be safely reduced.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system, performance
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.