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

Speed up builds of freshly checked out branches #10519

Closed
wants to merge 2 commits into from

Conversation

nineinchnick
Copy link
Member

@nineinchnick nineinchnick commented Jan 10, 2022

Add a quick profile, which allows to quickly build the project without any checks or tests, assuming it has just been checked out from a clean branch (master) which has been tested by the CI workflow and is known to be correct. The new profile is supposed to make it easier, instead of having to remember all the correct properties (compare the commands in the next section).

I'm not disabling any modules (like docs) on purpose, they still have to be disabled explicitly. Note that building the tarball with Provisio takes up ~25% of wall-time, and the GC and JIT take ~50%.

Timings

I ran all the commands on my macbook with the profiler enabled:

export MAVEN_OPTS="-agentpath:$HOME/Downloads/async-profiler-2.5.1-macos/build/libasyncProfiler.dylib=start,event=cpu,file=mvn-profile.html"

Base

Running on master (only skip tests and checks):

./mvnw clean install --strict-checksums -V -DskipTests -Dair.check.skip-all -pl '!:trino-server-rpm,!docs' 

yields Total time: 04:41 min.

When also skipping test compilation, building source JARs, and others:

./mvnw clean install --strict-checksums -V -DskipTests -Dmaven.test.skip=true -Dmaven.source.skip=true -Dmaven.site.skip=true -Dmaven.javadoc.skip=true -Dair.check.skip-all -pl '!:trino-server-rpm,!docs'

yields Total time: 03:48 min.

Running the same command using Maven Daemon, the 3rd run after starting the daemon yields Total time: 01:28 min (Wall Clock).

With the profile

Running:

./mvnw clean install --strict-checksums -V -Dquick -pl '!:trino-server-rpm,!docs'

yields Total time: 03:08 min, 40 seconds quicker.

Running this 3rd time after starting the daemon:

mvnd clean install --strict-checksums -V -Dquick -pl '!:trino-server-rpm,!docs'

yields Total time: 01:19 min (Wall Clock), 10 seconds quicker.

All the work here is based solely on https://peter.palaga.org/presentations/211021-baselone-maven-my-life-is-short/

@cla-bot cla-bot bot added the cla-signed label Jan 10, 2022
Copy link
Member

@hashhar hashhar left a comment

Choose a reason for hiding this comment

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

Who is the expected user of the quick profile?

Can you extract "Run git commit id Maven plugin only once" to separate PR. It's non-controversial and always a gain so it can be merged right now.

pom.xml Outdated Show resolved Hide resolved
pom.xml Outdated Show resolved Hide resolved
pom.xml Outdated Show resolved Hide resolved
pom.xml Outdated Show resolved Hide resolved
pom.xml Outdated Show resolved Hide resolved
pom.xml Outdated Show resolved Hide resolved
@findepi
Copy link
Member

findepi commented Jan 10, 2022

cc @losipiuk

.github/workflows/ci.yml Outdated Show resolved Hide resolved
pom.xml Outdated Show resolved Hide resolved
@nineinchnick nineinchnick force-pushed the quick-build branch 5 times, most recently from 598e52d to 78e26ce Compare January 12, 2022 09:23
@nineinchnick
Copy link
Member Author

I'm closing this. The gain of adding options other than -DskipTests -Dair.check.skip-all is tiny, about 4 seconds, and we can't reliably disable test compilation. Other changes are in airlift/airbase#293

@nineinchnick
Copy link
Member Author

Benchmark results:

Benchmark 1: ./mvnw clean install -Pquick -pl "!:trino-server-rpm,!docs"
  Time (mean ± σ):     382.767 s ± 28.953 s    [User: 509.683 s, System: 24.475 s]
  Range (min … max):   362.434 s … 415.916 s    3 runs
 
Benchmark 2: ./mvnw clean install -DskipTests -Dair.check.skip-all=true -pl "!:trino-server-rpm,!docs"
  Time (mean ± σ):     368.216 s ±  1.681 s    [User: 512.733 s, System: 25.812 s]
  Range (min … max):   366.666 s … 370.003 s    3 runs

There's some variance for -Pquick but notice how small is difference in the minimum time.

I also ran benchmarks for the noTests profile, that only works when ~/.m2/repository is populated (any previous mvn install completed):

Benchmark 1: ./mvnw clean install -Pquick,noTests -pl "!:trino-server-rpm,!docs"
  Time (mean ± σ):     276.097 s ±  0.659 s    [User: 366.680 s, System: 21.953 s]
  Range (min … max):   275.593 s … 276.842 s    3 runs

@ksobolew
Copy link
Contributor

Is there some value in the first commit alone? Seems like a nice cleanup at least.

@nineinchnick
Copy link
Member Author

It'll allow to avoid loading unused plugins in some cases, but the actual time difference is 1-2 second. I can open up another PR with only that if airlift/airbase#293 gets merged, there won't be any difference without it.

@nineinchnick nineinchnick deleted the quick-build branch May 27, 2024 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

6 participants