____ __
___ _______ / _(_) /__ ____
/ _ \/ __/ _ \/ _/ / / -_) __/
/ .__/_/ \___/_//_/_/\__/_/
/_/ utilities
Today, there are many great articles about optimizing Android builds. Larger companies are able to do neat things like this. For smaller companies, indie projects, or hobby projects, this is a bit trickier to do, often letting developers make changes and hope for the best.
This repository aims to contain a set of tools to make it easy for any project to monitor build times. In the future, this project may expand to support other types of benchmarks (i.e. macrobenchmark and microbenchmark tests). Today, the tools in this repository support writing data to a Google Sheet, though more options may be considered in the future.
I am planning to write a detailed blog post about this, combined with better documentation. For now, here is some barebones documentation.
Obtain a Google Sheets service json file from the Credentials section here. Copy the email address associated with this account. Make a new spreadsheet on Google Drive, and grant the aforementioned email address edit permissions to the spreadsheet. Note that the spreadsheet id is the part between /d/
and /edit
in the url to the spreadsheet.
Don't forget to also enable Google Sheets API access from the same dashboard under "Enabled APIs and Services."
This mode reads a benchmark.csv
file from a gradle-profiler run and adds data for it to the Google Sheet.
Usage:
java -jar profileuploader-r8.jar upload-profiling-data \
--spreadsheet-id <spreadsheet-id> \
--auth-file <service_account_credentials.json> \
--git-hash <git hash of the build> \
--notes <optional notes about this build> \
--benchmark-file <path to benchmark.csv>
You can also optionally pass in a --spreadsheet-read-range
flag (defaulting to Sheet1!A1:Z
), if your sheet is not called "Sheet1", and if the column doesn't start at A1
.
Given a Google Sheet of benchmarking data, this runs a step algorithm as described here to detect whether a build likely caused an improvement or a regression.
Usage:
java -jar profileuploader-r8.jar check-deltas \
--spreadsheet-id <spreadsheet-id> \
--auth-file <service_account_credentials.json>
It optionally takes in the following parameters:
--width - the number of builds before and after the build to check.
--threshold - the threshold for which to consider something as a change.
--debug - enable more verbose debug logging.
You can also pass in a --spreadsheet-read-range
to specify where to read the data (defaults to Sheet1!A1:Z
- change Z if you have more than 26 scenarios, and change Sheet1 if your sheet with the data is not Sheet1).