Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding benchmarking script to start monitoring build times #4070

Merged
merged 1 commit into from
Sep 24, 2021

Conversation

ouchadam
Copy link
Contributor

@ouchadam ouchadam commented Sep 23, 2021

Adds a script to run the gradle-profiler so that we can start monitoring and quantifying build time improvements

Usage

  • Requires the gradle-profile to be installed
  • running from the root of the repository ./tools/benchmark/run_benchmark.sh "comma separated scenario names or blank to run all"`

The warm up and run iterations have been reduced from the defaults, makes the overall suite take less time but at the cost some reliability

Here's some early results...

Recompiling

assemble {
  tasks = [":vector:assembleGPlayDebug"]
}

2021-09-23T16:08:22,201186771+01:00

recompiling without any changes takes 1 second~ it's almost entirely gradle configuration, it shows our gradle setup isn't invaliding the configuration and causing extra processing

Clean builds

assemble clean builds with and without the build cache, build cache is disabled by default

assemble {
  tasks = ["clean", ":vector:assembleGPlayDebug"]
}

assemble_build_cache {
  tasks = ["clean", ":vector:assembleGPlayDebug"]
  gradle-args = ["--build-cache"]
}

2021-09-23T15:49:46,263256186+01:00

From these results we can see that the build cache saves a massive amount of build time, 2m 30s~ down to 14~ seconds, not too unexpected as the build cache doesn't get cleared with a clean and since we're only doing a clean we should get lots of cache hits.

Incremental

Making a non ABI and ABI change in the matrix sdk module

2021-09-23T16:07:57,679358923+01:00

a 15 second~ incremental time shows us at a high level that the SDK module in correctly compiling incrementally, a clean assembly of the sdk module takes 1 minute~. Bencharking ABI changes will be more useful as we introduce more modules as gradle will force clients of modules with ABI to also recompile.

More information can be found at https://developer.android.com/studio/build/profile-your-build

- makes use of the gradle-profiler to run the build multiple times
- currently uses reduced warm up/iteration count as the build takes a long time, can be increased once the build time is reduced
@github-actions
Copy link

github-actions bot commented Sep 23, 2021

Unit Test Results

  34 files  ±0    34 suites  ±0   24s ⏱️ ±0s
  73 tests ±0    73 ✔️ ±0  0 💤 ±0  0 ❌ ±0 
180 runs  ±0  180 ✔️ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit b5fadaa. ± Comparison against base commit b5fadaa.

♻️ This comment has been updated with latest results.

Copy link
Member

@bmarty bmarty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really interesting thanks.
By monitoring, you mean let the CI run gradle-profiler?

@ouchadam
Copy link
Contributor Author

@bmarty it could be the CI if we want to automate build times and produce a dashboard (which would be pretty nice!) although to start with running locally periodically would be simpler

Copy link
Member

@bmarty bmarty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@bmarty bmarty merged commit b5fadaa into develop Sep 24, 2021
@bmarty bmarty deleted the tools/adm/benchmark branch September 24, 2021 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants