Skip to content

Speed up builds of freshly checked out branches#10519

Closed
nineinchnick wants to merge 2 commits intotrinodb:masterfrom
nineinchnick:quick-build
Closed

Speed up builds of freshly checked out branches#10519
nineinchnick wants to merge 2 commits intotrinodb:masterfrom
nineinchnick:quick-build

Conversation

@nineinchnick
Copy link
Copy Markdown
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
Copy Markdown
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.

Comment thread pom.xml Outdated
Comment thread pom.xml Outdated
Comment thread pom.xml Outdated
Comment thread pom.xml Outdated
Comment thread pom.xml Outdated
Comment thread pom.xml Outdated
@findepi
Copy link
Copy Markdown
Member

findepi commented Jan 10, 2022

cc @losipiuk

Comment thread .github/workflows/ci.yml Outdated
Comment thread pom.xml Outdated
@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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor

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

@nineinchnick
Copy link
Copy Markdown
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