Commit Graph

4 Commits

Author SHA1 Message Date
Kevin Lubick
fb13c18ddf [bazel] Update to v5.2.0
The primary change we are looking for is
"Add support for .ar archives (and .deb files)
https://github.com/bazelbuild/bazel/pull/15218"

https://blog.bazel.build/2022/06/08/bazel-5.2.html

In theory, we should be able to trigger Linux RBE
compilations (e.g. IWYU) from Mac with this change.

Change-Id: I217406d21fd55507e090c4bb5f79c796230717e6
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/549659
Reviewed-by: Joe Gregorio <jcgregorio@google.com>
2022-06-13 20:35:18 +00:00
Kevin Lubick
e25e4dc7e7 [bazel] Specify files required for the toolchain more precisely.
This improves performance with sandboxing.

One can have Bazel output performance data [1][2], which can be
viewed via chrome://tracing or https://ui.perfetto.dev/.

With Perfetto, the following SQL queries [3][4] can summarize
the sandboxing metrics, as well as the actual compilation
time. http://screen/5TxbeZTso4gNDfD
Note that the dur column is in nanoseconds, so we convert
to seconds. These numbers could further be divided by
the number of processes (in my case 48) to get a scaled output.

SELECT SUM(dur) / 1000000000.0 FROM slice WHERE name = "sandbox.createFileSystem";
SELECT SUM(dur) / 1000000000.0 FROM slice WHERE name = "sandbox.delete";
SELECT SUM(dur) / 1000000000.0 FROM slice WHERE name = "subprocess.run";

I benchmarked the local compilation of //:skia_public using
--config=clang_linux (our custom Linux toolchain). I was
sure to clear the Bazel cache before each run and not count
the time to download/update a toolchain for the first time.

The control measurements (without this CL) are:
  Wall Time = 272.2s
  sandbox.createFileSystem = 5466.9s
  subprocess.run = 2961.0s
  sandbox.delete = 4112.3s

With this CL:
  Wall Time = 53.9s (5.05x faster)
  sandbox.createFileSystem = 403.4s
  subprocess.run = 1610.3s
  sandbox.delete = 348.8s

The control measurement is a touch misleading. Due to it being
so slow, I had recommended developers use a ramdisk when building
on machines with sufficient RAM via the Bazel flag
--sandbox_base=/dev/shm

Here is the control measurement when using a RAM disk:
  Wall Time = 21.2s
  sandbox.createFileSystem = 58.9s
  subprocess.run = 705.1s
  sandbox.delete = 46.6s

With this CL and a RAM disk:
  Wall Time = 19.2s (10% faster)
  sandbox.createFileSystem = 21.8s
  subprocess.run = 722.9s
  sandbox.delete = 16.2s

For devs who cannot or are not using a RAM disk, this is
a huge win. With a RAM disk, it's a modest improvement.

On an RBE build, this had minimal impact. I did my best
to bust the action cache with a fake define and the before
and after times were about the same.

This was inspired by [5] and [6].

[1] Add --profile=/tmp/profile.gz to any command
[2] https://bazel.build/rules/performance#performance-profiling
[3] https://perfetto.dev/docs/quickstart/trace-analysis#sample-queries
[4] https://perfetto.dev/docs/analysis/sql-tables#slice
[5] 93f21c9ef3
[6] 311acff345
Change-Id: Iceb2606e86111159141a286d01fc002d09fe3fe4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/547822
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
2022-06-09 11:58:45 +00:00
Jorge Betancourt
b894c69abb set up tools for building Skia on Mac semi hermetically
Reviewer notes:
PS1 and PS2 handle everything up to the linking stage of the build
PS6 and PS7 are trivial renamings and rebases, diff between Base->PS5 for a cleaner review

No-Try: true
Change-Id: Ib21ce2e8839ecd4b4dd57280e82f56a98194e476
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/532765
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Jorge Betancourt <jmbetancourt@google.com>
2022-05-04 16:56:46 +00:00
Kevin Lubick
9b7db63e6f [bazel] Sketch out changes for Mac toolchain
Change-Id: Idae84d8d9538012e5cfb75a1a477dbc72a4da5bc
Bug: skia:13125
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/526264
Reviewed-by: Jorge Betancourt <jmbetancourt@google.com>
2022-04-08 13:35:44 +00:00