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

Reduce build time by 35% #354

Merged
merged 2 commits into from
Dec 6, 2023
Merged

Reduce build time by 35% #354

merged 2 commits into from
Dec 6, 2023

Conversation

geedo0
Copy link
Contributor

@geedo0 geedo0 commented Dec 5, 2023

Issue #, if available:
CryptoAlg-2210

Description of changes:
The gradle tasks coverage_exec and test_exec correspond to the
underlying CMake tasks coverage and check respectively. In CMake,
the coverage task depends on check. Because of how the gradle task
dependencies are wired up we run these tasks separately and end up
running the CMake check task twice. The check target is responsible for
running all of our unit tests which is by far the longest portion of our
build which is why not doing that twice cuts our build time by 35%. This
avoids the redundancy by re-arranging the dependency graph in gradle to
run coverage once and generate both unit test and coverage reports out
of it.

# Run this to profile the build
./gradlew --profile release

# Before this change we get this total build time
Total Build Time  11m11.85s

## We end up running these Gradle tasks which account for the bulk of our build
:coverage_exec  4m49.22s  
:test_exec  3m55.42s  
:buildAwsLc   1m39.76s  
...

# After this change, here's the new build time
Total Build Time  7m20.29s

## The speedup here comes from eliminating the :test_exec Task
:coverage_exec  4m51.70s  
:buildAwsLc   1m39.82s  
...

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

The gradle tasks coverage_exec and test_exec correspond to the
underlying CMake tasks coverage and check respectively. In CMake,
the coverage task depends on check. Because of how the gradle task
dependencies are wired up we run these tasks separately and end up
running the CMake check task twice. The check target is responsible for
running all of our unit tests which is by far the longest portion of our
build which is why not doing that twice cuts our build time by 35%. This
avoids the redundancy by re-arranging the dependency graph in gradle to
run coverage once and generate both unit test and coverage reports out
of it.
@geedo0 geedo0 requested a review from a team as a code owner December 5, 2023 20:12
build.gradle Outdated Show resolved Hide resolved
Copy link
Contributor

@WillChilds-Klein WillChilds-Klein left a comment

Choose a reason for hiding this comment

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

nice find!

@geedo0 geedo0 merged commit 6e716d7 into corretto:main Dec 6, 2023
6 checks passed
@geedo0 geedo0 deleted the optimize-build branch December 6, 2023 15:17
amirhosv added a commit to amirhosv/amazon-corretto-crypto-provider that referenced this pull request Jan 9, 2024
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.

3 participants