You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Mark Raynsford <or...@io7m.com> on 2018/04/13 19:20:11 UTC

Speeding up Maven

Hello.

Is there any way I might speed up Maven? I've been using it for years
and, for the first time, I'm actually executing it from an IDE rather
than using the IDE's built-in compiler. It seems like there's a rather
large and apparently fixed amount of overhead per invocation. Take the
following "could not be simpler" project:

  https://github.com/io7m/maven-minimal-20180413

I piped the output through tai64n [1] to give a better indication of
exactly how long everything is taking. That's a project that compiles a
single Java file and produces a jar. It doesn't run any tests, it
doesn't include any resources. 16 seconds total execution [2]!

Now for an infrequent command-line build, that's not *too* obnoxious.
For a "click a button in the IDE because I want to try this bit of code
now" build, that's a world of suffering.

It seems like Maven first spends ten entire seconds doing not very
much. That cannot be attributed to JVM startup time (Hello World on my
system takes about 100ms to reach user code, and even the largest Java
application I still takes less than a second to reach user code after
all the classes have loaded).

Is there anything I can do to cut this down? If not, is this something
that's intended to be addressed in the near future?

[1] http://cr.yp.to/daemontools/tai64n.html
[2] The Maven output claims 6 seconds, but that doesn't include the
    time it took for the build to start.

-- 
Mark Raynsford | http://www.io7m.com


Re: Speeding up Maven

Posted by Karl Heinz Marbaise <kh...@gmx.de>.
Hi Mark,

I simply missed this project:

https://github.com/khmarbaise/maven-buildtime-profiler

Kind regards
Karl Heinz Marbaise


On 13/04/18 21:20, Mark Raynsford wrote:
> Hello.
> 
> Is there any way I might speed up Maven? I've been using it for years
> and, for the first time, I'm actually executing it from an IDE rather
> than using the IDE's built-in compiler. It seems like there's a rather
> large and apparently fixed amount of overhead per invocation. Take the
> following "could not be simpler" project:
> 
>    https://github.com/io7m/maven-minimal-20180413
> 
> I piped the output through tai64n [1] to give a better indication of
> exactly how long everything is taking. That's a project that compiles a
> single Java file and produces a jar. It doesn't run any tests, it
> doesn't include any resources. 16 seconds total execution [2]!
> 
> Now for an infrequent command-line build, that's not *too* obnoxious.
> For a "click a button in the IDE because I want to try this bit of code
> now" build, that's a world of suffering.
> 
> It seems like Maven first spends ten entire seconds doing not very
> much. That cannot be attributed to JVM startup time (Hello World on my
> system takes about 100ms to reach user code, and even the largest Java
> application I still takes less than a second to reach user code after
> all the classes have loaded).
> 
> Is there anything I can do to cut this down? If not, is this something
> that's intended to be addressed in the near future?
> 
> [1] http://cr.yp.to/daemontools/tai64n.html
> [2] The Maven output claims 6 seconds, but that doesn't include the
>      time it took for the build to start.
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: Speeding up Maven

Posted by Mark Raynsford <or...@io7m.com>.
On 2018-04-13T21:48:58 +0200
Karl Heinz Marbaise <kh...@gmx.de> wrote:

> Hi Mark,

'Ello.

> On 13/04/18 21:20, Mark Raynsford wrote:
> 
> First it would be good to know which Maven version are you using? And on 
> which JDK you are running?

Hah, I purposefully left out details in the hope that it wouldn't be my
problem specifically. From the one second build you've described, it
appears that perhaps it might be.

My system:

Linux copperhead.int.arc7.info 4.15.14-1-ARCH #1 SMP PREEMPT Wed Mar 28
17:34:29 UTC 2018 x86_64 GNU/Linux

Intel(R) Core(TM) i5-2410M CPU @ 2.30GHz, 8GB ram.

openjdk version "9.0.4"
OpenJDK Runtime Environment (build 9.0.4+11)
OpenJDK 64-Bit Server VM (build 9.0.4+11, mixed mode)

Apache Maven 3.5.2 (NON-CANONICAL_2017-10-25T13:09:52+03:00_root;
2017-10-25T10:09:52Z) Maven home: /opt/maven
Java version: 9.0.4, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-9-openjdk
Default locale: en_GB, platform encoding: UTF-8
OS name: "linux", version: "4.15.14-1-arch", arch: "amd64", family:
"unix"

> Maybe I misunderstand you ...are you running it from plain command line 
> or from inside your IDE ?

The command line in the log is:

  mvn -Dmaven.tests.skip=true -DskipTests=true package

Although in the IDE in real projects, I'm skipping more plugin
executions than that.

> 
> What are you memory settings? How is your JDK configured ? Which command 
> line options ? (MAVEN_OPTS?):??

I'm both running it from the command line and from the IDE. My point
was that 16 seconds for a command line build is tolerable (although 
still pretty damn high for a project that only compiles one Java file 
and doesn't do anything else), but running the same build from within 
an IDE is painful (because in the IDE, I'm hoping for instant gratification
when I click "Run..." and I don't care about producing a full build
that someone else will use).

$ env | grep MAVEN
MAVEN_OPTS=-Xmx512m

My JDK is essentially unconfigured. Whatever the default settings are
for Linux AMD64, OpenJDK 9.

> Depending on your JVM and the configuration that can be quite large 
> different time on startup...there are several configurations which can 
> be used to improve that...

I'm open to suggestions. I'm fairly confident that it's not JVM startup
time that's the issue. For example, if I add the -X flag to Maven, you
can see that control reaches whatever passes for Maven's main() function
in roughly one second:

2018-04-13 21:00:01.455570500 
2018-04-13 21:00:02.740905500 Apache Maven 3.5.2 (NON-CANONICAL_2017-10-25T13:09:52+03:00_root; 2017-10-25T10:09:52Z)
2018-04-13 21:00:02.741034500 Maven home: /opt/maven
2018-04-13 21:00:02.741192500 Java version: 9.0.4, vendor: Oracle Corporation
2018-04-13 21:00:02.741333500 Java home: /usr/lib/jvm/java-9-openjdk
2018-04-13 21:00:02.741454500 Default locale: en_GB, platform encoding: UTF-8
2018-04-13 21:00:02.741829500 OS name: "linux", version: "4.15.14-1-arch", arch: "amd64", family: "unix"
2018-04-13 21:00:06.841656500 [DEBUG] Created new class realm maven.api
2018-04-13 21:00:06.842724500 [DEBUG] Importing foreign packages into class realm maven.api
2018-04-13 21:00:06.844680500 [DEBUG]   Imported: javax.annotation.* < plexus.core
2018-04-13 21:00:06.847413500 [DEBUG]   Imported: javax.enterprise.inject.* < plexus.core
2018-04-13 21:00:06.847911500 [DEBUG]   Imported: javax.enterprise.util.* < plexus.core
2018-04-13 21:00:06.848473500 [DEBUG]   Imported: javax.inject.* < plexus.core
2018-04-13 21:00:06.849076500 [DEBUG]   Imported: org.apache.maven.* < plexus.core
2018-04-13 21:00:06.849575500 [DEBUG]   Imported: org.apache.maven.artifact < plexus.core
2018-04-13 21:00:06.850103500 [DEBUG]   Imported: org.apache.maven.classrealm < plexus.core
2018-04-13 21:00:06.850619500 [DEBUG]   Imported: org.apache.maven.cli < plexus.core
2018-04-13 21:00:06.851178500 [DEBUG]   Imported: org.apache.maven.configuration < plexus.core
2018-04-13 21:00:06.851678500 [DEBUG]   Imported: org.apache.maven.exception < plexus.core
2018-04-13 21:00:06.852183500 [DEBUG]   Imported: org.apache.maven.execution < plexus.core
2018-04-13 21:00:06.852685500 [DEBUG]   Imported: org.apache.maven.execution.scope < plexus.core
2018-04-13 21:00:06.853183500 [DEBUG]   Imported: org.apache.maven.lifecycle < plexus.core
2018-04-13 21:00:06.853653500 [DEBUG]   Imported: org.apache.maven.model < plexus.core
2018-04-13 21:00:06.854292500 [DEBUG]   Imported: org.apache.maven.monitor < plexus.core
2018-04-13 21:00:06.854777500 [DEBUG]   Imported: org.apache.maven.plugin < plexus.core
2018-04-13 21:00:06.855287500 [DEBUG]   Imported: org.apache.maven.profiles < plexus.core
2018-04-13 21:00:06.855786500 [DEBUG]   Imported: org.apache.maven.project < plexus.core
2018-04-13 21:00:06.856284500 [DEBUG]   Imported: org.apache.maven.reporting < plexus.core
2018-04-13 21:00:06.856757500 [DEBUG]   Imported: org.apache.maven.repository < plexus.core
2018-04-13 21:00:06.857291500 [DEBUG]   Imported: org.apache.maven.rtinfo < plexus.core
2018-04-13 21:00:06.857751500 [DEBUG]   Imported: org.apache.maven.settings < plexus.core
2018-04-13 21:00:06.858242500 [DEBUG]   Imported: org.apache.maven.toolchain < plexus.core
2018-04-13 21:00:06.858750500 [DEBUG]   Imported: org.apache.maven.usability < plexus.core
2018-04-13 21:00:06.859247500 [DEBUG]   Imported: org.apache.maven.wagon.* < plexus.core
2018-04-13 21:00:06.859817500 [DEBUG]   Imported: org.apache.maven.wagon.authentication < plexus.core
2018-04-13 21:00:06.860359500 [DEBUG]   Imported: org.apache.maven.wagon.authorization < plexus.core
2018-04-13 21:00:06.860882500 [DEBUG]   Imported: org.apache.maven.wagon.events < plexus.core
2018-04-13 21:00:06.861413500 [DEBUG]   Imported: org.apache.maven.wagon.observers < plexus.core
2018-04-13 21:00:06.861943500 [DEBUG]   Imported: org.apache.maven.wagon.proxy < plexus.core
2018-04-13 21:00:06.862494500 [DEBUG]   Imported: org.apache.maven.wagon.repository < plexus.core
2018-04-13 21:00:06.862991500 [DEBUG]   Imported: org.apache.maven.wagon.resource < plexus.core
2018-04-13 21:00:06.863587500 [DEBUG]   Imported: org.codehaus.classworlds < plexus.core
2018-04-13 21:00:06.864084500 [DEBUG]   Imported: org.codehaus.plexus.* < plexus.core
2018-04-13 21:00:06.864589500 [DEBUG]   Imported: org.codehaus.plexus.classworlds < plexus.core
2018-04-13 21:00:06.865246500 [DEBUG]   Imported: org.codehaus.plexus.component < plexus.core
2018-04-13 21:00:06.865785500 [DEBUG]   Imported: org.codehaus.plexus.configuration < plexus.core
2018-04-13 21:00:06.866347500 [DEBUG]   Imported: org.codehaus.plexus.container < plexus.core
2018-04-13 21:00:06.866863500 [DEBUG]   Imported: org.codehaus.plexus.context < plexus.core
2018-04-13 21:00:06.867389500 [DEBUG]   Imported: org.codehaus.plexus.lifecycle < plexus.core
2018-04-13 21:00:06.867877500 [DEBUG]   Imported: org.codehaus.plexus.logging < plexus.core
2018-04-13 21:00:06.868428500 [DEBUG]   Imported: org.codehaus.plexus.personality < plexus.core
2018-04-13 21:00:06.868969500 [DEBUG]   Imported: org.codehaus.plexus.util.xml.Xpp3Dom < plexus.core
2018-04-13 21:00:06.869528500 [DEBUG]   Imported: org.codehaus.plexus.util.xml.pull.XmlPullParser < plexus.core
2018-04-13 21:00:06.870156500 [DEBUG]   Imported: org.codehaus.plexus.util.xml.pull.XmlPullParserException < plexus.core
2018-04-13 21:00:06.870915500 [DEBUG]   Imported: org.codehaus.plexus.util.xml.pull.XmlSerializer < plexus.core
2018-04-13 21:00:06.871710500 [DEBUG]   Imported: org.eclipse.aether.* < plexus.core
2018-04-13 21:00:06.872369500 [DEBUG]   Imported: org.eclipse.aether.artifact < plexus.core
2018-04-13 21:00:06.872882500 [DEBUG]   Imported: org.eclipse.aether.collection < plexus.core
2018-04-13 21:00:06.873802500 [DEBUG]   Imported: org.eclipse.aether.deployment < plexus.core
2018-04-13 21:00:06.874304500 [DEBUG]   Imported: org.eclipse.aether.graph < plexus.core
2018-04-13 21:00:06.874690500 [DEBUG]   Imported: org.eclipse.aether.impl < plexus.core
2018-04-13 21:00:06.875170500 [DEBUG]   Imported: org.eclipse.aether.installation < plexus.core
2018-04-13 21:00:06.875679500 [DEBUG]   Imported: org.eclipse.aether.internal.impl < plexus.core
2018-04-13 21:00:06.876191500 [DEBUG]   Imported: org.eclipse.aether.metadata < plexus.core
2018-04-13 21:00:06.876668500 [DEBUG]   Imported: org.eclipse.aether.repository < plexus.core
2018-04-13 21:00:06.877151500 [DEBUG]   Imported: org.eclipse.aether.resolution < plexus.core
2018-04-13 21:00:06.877530500 [DEBUG]   Imported: org.eclipse.aether.spi < plexus.core
2018-04-13 21:00:06.877950500 [DEBUG]   Imported: org.eclipse.aether.transfer < plexus.core
2018-04-13 21:00:06.878354500 [DEBUG]   Imported: org.eclipse.aether.version < plexus.core
2018-04-13 21:00:06.878870500 [DEBUG]   Imported: org.fusesource.jansi.* < plexus.core
2018-04-13 21:00:06.879322500 [DEBUG]   Imported: org.slf4j.* < plexus.core
2018-04-13 21:00:06.879766500 [DEBUG]   Imported: org.slf4j.helpers.* < plexus.core
2018-04-13 21:00:06.880195500 [DEBUG]   Imported: org.slf4j.spi.* < plexus.core
2018-04-13 21:00:06.880859500 [DEBUG] Populating class realm maven.api
2018-04-13 21:00:07.210344500 [INFO] Error stacktraces are turned on.
2018-04-13 21:00:07.210806500 [DEBUG] Message scheme: color
2018-04-13 21:00:07.214240500 [DEBUG] Message styles: debug info warning error success failure strong mojo project
2018-04-13 21:00:07.236587500 [DEBUG] Reading global settings from /opt/maven/conf/settings.xml
2018-04-13 21:00:07.237263500 [DEBUG] Reading user settings from /home/someone/.m2/settings.xml
2018-04-13 21:00:07.343776500 [DEBUG] Reading global toolchains from /opt/maven/conf/toolchains.xml
2018-04-13 21:00:07.344127500 [DEBUG] Reading user toolchains from /home/someone/.m2/toolchains.xml
2018-04-13 21:00:07.381532500 [DEBUG] Using local repository at /home/someone/.m2/repository
2018-04-13 21:00:07.482942500 [DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10.0 for /home/someone/.m2/repository
2018-04-13 21:00:07.528131500 [INFO] Scanning for projects...

You can see that it takes roughly a second to get as far as
printing the "Apache Maven 3.5.2..." message, and then takes 
about four seconds to get to "Created new class realm...". 
It's up to seven seconds before it even starts scanning for 
projects. The build then takes a good 5-7 seconds on top of
that. That equates to about twelve seconds minimum when I 
click "Run..." in an IDE, for a single-module build with
next to no plugins executing.

Are there options that can improve Maven's startup time?

The maven-buildtime-profiler plugin will definitely be useful
for larger builds, but right now I'm concerned about this
bit of overhead that appears to be present for even the most 
trivial of builds. I'm not sure the profiler will even see that
overhead as it happens before the profiler would have a chance 
to capture data.

-- 
Mark Raynsford | http://www.io7m.com


Re: Speeding up Maven

Posted by Karl Heinz Marbaise <kh...@gmx.de>.
Hi Mark,


On 13/04/18 21:20, Mark Raynsford wrote:

First it would be good to know which Maven version are you using? And on 
which JDK you are running?


> Hello.
> 
> Is there any way I might speed up Maven? I've been using it for years
> and, for the first time, I'm actually executing it from an IDE rather
> than using the IDE's built-in compiler. It seems like there's a rather
> large and apparently fixed amount of overhead per invocation. Take the
> following "could not be simpler" project:
> 
>    https://github.com/io7m/maven-minimal-20180413


Maybe I misunderstand you ...are you running it from plain command line 
or from inside your IDE ?

What are you memory settings? How is your JDK configured ? Which command 
line options ? (MAVEN_OPTS?):??



> 
> I piped the output through tai64n [1] to give a better indication of
> exactly how long everything is taking. That's a project that compiles a
> single Java file and produces a jar. It doesn't run any tests, it
> doesn't include any resources. 16 seconds total execution [2]!


Unfortunately I don't have tai64n on my Mac but based on simple tests 
with your project I can run the whole project in about 1 Second for the 
whole build...


> 
> Now for an infrequent command-line build, that's not *too* obnoxious.
> For a "click a button in the IDE because I want to try this bit of code
> now" build, that's a world of suffering.
> 
> It seems like Maven first spends ten entire seconds doing not very
> much. That cannot be attributed to JVM startup time (Hello World on my
> system takes about 100ms to reach user code, and even the largest Java
> application I still takes less than a second to reach user code after
> all the classes have loaded).

Depending on your JVM and the configuration that can be quite large 
different time on startup...there are several configurations which can 
be used to improve that...

> 
> Is there anything I can do to cut this down? If not, is this something
> that's intended to be addressed in the near future?

I'm doing from time to time analyzes based on performance / Memory...but 
I'm interested to do more here...


> 
> [1] http://cr.yp.to/daemontools/tai64n.html
> [2] The Maven output claims 6 seconds, but that doesn't include the
>      time it took for the build to start.
> 


Kind regards
Karl Heinz Marbaise

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: Speeding up Maven

Posted by Paul Hammant <pa...@hammant.org>.
Can you yourself try another dissimilar machine?

Re: Speeding up Maven

Posted by Kristian Rosenvold <kr...@gmail.com>.
Just make sure you're not running low on entropy on your linux box, all
sorts of weird slowdowns happen then.

https://major.io/2007/07/01/check-available-entropy-in-linux/

Kristian


2018-04-16 11:28 GMT+02:00 Mark Raynsford <or...@io7m.com>:

> With absolutely impeccable timing, I've had a couple of hardware
> failures. It is theoretically possible that this was the cause of the
> performance issues - although there were no error messages logged
> anywhere.
>
> I'm waiting for replacement parts, so it'll be a week or so before I
> can continue pulling on this thread.
>
> Thanks for the responses, all!
>
> --
> Mark Raynsford | http://www.io7m.com
>
>

Re: Speeding up Maven

Posted by Mark Raynsford <or...@io7m.com>.
With absolutely impeccable timing, I've had a couple of hardware
failures. It is theoretically possible that this was the cause of the
performance issues - although there were no error messages logged
anywhere.

I'm waiting for replacement parts, so it'll be a week or so before I
can continue pulling on this thread.

Thanks for the responses, all!

-- 
Mark Raynsford | http://www.io7m.com


Re: Speeding up Maven

Posted by Mark Raynsford <or...@io7m.com>.
On 2018-04-14T09:02:55 +0000
Bernd Eckenfels <ec...@zusammenkunft.net> wrote:

> Hello,
> 
> Maven is not the fastest, but in your case it sounds unusual slow. What are your machine specs? Any SSD? Do you happen to have a on-access malware scanner active? They react very bad to Java scanning large number of JAR files.

Intel(R) Core(TM) i5-2410M CPU @ 2.30GHz, 8GB RAM, 7200 RPM non-SSD
drive.

No malware scanner (I'm on Linux).

Going to try to set up another workstation today to see if I can
duplicate the problem there.

-- 
Mark Raynsford | http://www.io7m.com


Re: Speeding up Maven

Posted by Bernd Eckenfels <ec...@zusammenkunft.net>.
Hello,

Maven is not the fastest, but in your case it sounds unusual slow. What are your machine specs? Any SSD? Do you happen to have a on-access malware scanner active? They react very bad to Java scanning large number of JAR files.

Gruss
Bernd

Gruss
Bernd
--
http://bernd.eckenfels.net
________________________________
From: Mark Raynsford <or...@io7m.com>
Sent: Friday, April 13, 2018 11:21:33 PM
To: Paul Hammant
Cc: Maven Developers List
Subject: Re: Speeding up Maven

On 2018-04-13T16:29:27 -0400
Paul Hammant <pa...@hammant.org> wrote:

> Mark,
>
> Assuming a pre-filled Maven local cache, I've a 16 second build that's only
> longer when I run a screen recorder in order to make the video show here -
> https://paulhammant.com/2017/02/05/a-16-second-java-webapp-build-including-webdriver-tests/
>
> That one runs three WebDriver tests too after the unit and service tests -
> meaning (implicitly) it's testing JavaScript as well as Java in that time.
>
> In order to make it fast I've abandoned the fail-safe plugin and do all
> parts of the test-pyramid in surefire (see the pom).

'Ello.

So you're saying it's my problem? ;)

I'm also assuming a pre-filled Maven local cache, but this example
project (with no dependencies) takes about six seconds to build with
(usually) about ten seconds of Maven churning before the build even
begins. This is for a build that compiles one tiny file, produces a
jar, and does nothing else.

I assumed that it was happening for everyone, but apparently it isn't.

--
Mark Raynsford | http://www.io7m.com


Re: Speeding up Maven

Posted by Mark Raynsford <or...@io7m.com>.
On 2018-04-13T16:29:27 -0400
Paul Hammant <pa...@hammant.org> wrote:

> Mark,
> 
> Assuming a pre-filled Maven local cache, I've a 16 second build that's only
> longer when I run a screen recorder in order to make the video show here -
> https://paulhammant.com/2017/02/05/a-16-second-java-webapp-build-including-webdriver-tests/
> 
> That one runs three WebDriver tests too after the unit and service tests -
> meaning (implicitly) it's testing JavaScript as well as Java in that time.
> 
> In order to make it fast I've abandoned the fail-safe plugin and do all
> parts of the test-pyramid in surefire (see the pom).

'Ello.

So you're saying it's my problem? ;)

I'm also assuming a pre-filled Maven local cache, but this example
project (with no dependencies) takes about six seconds to build with
(usually) about ten seconds of Maven churning before the build even
begins. This is for a build that compiles one tiny file, produces a
jar, and does nothing else.

I assumed that it was happening for everyone, but apparently it isn't.

-- 
Mark Raynsford | http://www.io7m.com


Re: Speeding up Maven

Posted by Paul Hammant <pa...@hammant.org>.
Mark,

Assuming a pre-filled Maven local cache, I've a 16 second build that's only
longer when I run a screen recorder in order to make the video show here -
https://paulhammant.com/2017/02/05/a-16-second-java-webapp-build-including-webdriver-tests/

That one runs three WebDriver tests too after the unit and service tests -
meaning (implicitly) it's testing JavaScript as well as Java in that time.

In order to make it fast I've abandoned the fail-safe plugin and do all
parts of the test-pyramid in surefire (see the pom).

- Paul

On Fri, Apr 13, 2018 at 3:20 PM, Mark Raynsford <
org.apache.maven.user@io7m.com> wrote:

> Hello.
>
> Is there any way I might speed up Maven? I've been using it for years
> and, for the first time, I'm actually executing it from an IDE rather
> than using the IDE's built-in compiler. It seems like there's a rather
> large and apparently fixed amount of overhead per invocation. Take the
> following "could not be simpler" project:
>
>   https://github.com/io7m/maven-minimal-20180413
>
> I piped the output through tai64n [1] to give a better indication of
> exactly how long everything is taking. That's a project that compiles a
> single Java file and produces a jar. It doesn't run any tests, it
> doesn't include any resources. 16 seconds total execution [2]!
>
> Now for an infrequent command-line build, that's not *too* obnoxious.
> For a "click a button in the IDE because I want to try this bit of code
> now" build, that's a world of suffering.
>
> It seems like Maven first spends ten entire seconds doing not very
> much. That cannot be attributed to JVM startup time (Hello World on my
> system takes about 100ms to reach user code, and even the largest Java
> application I still takes less than a second to reach user code after
> all the classes have loaded).
>
> Is there anything I can do to cut this down? If not, is this something
> that's intended to be addressed in the near future?
>
> [1] http://cr.yp.to/daemontools/tai64n.html
> [2] The Maven output claims 6 seconds, but that doesn't include the
>     time it took for the build to start.
>
> --
> Mark Raynsford | http://www.io7m.com
>
>


-- 
Paul Hammant DevOps <https://devops.paulhammant.com> Let me give your
enterprise a step by step plan to get out of the hell of crazy branching
models (ClearCase maybe?) and into the world of high-throughput CD on
DevOps foundations.

Re: Speeding up Maven

Posted by John Patrick <nh...@gmail.com>.
Mark,
Your project on mine machine takes on average 2.5 second and that is
also doing a clean package each time, not just package.

Spec:
MacBook Pro (Retina, 13-inch, Late 2013)
Processor 2.8 GHz Intel Core i7
Memory 16 GB 1600 MHz DDR3
Disk 512GB SSD

$ java -version
java version "9.0.4"
Java(TM) SE Runtime Environment (build 9.0.4+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.4+11, mixed mode)
$ mvn -version
Apache Maven 3.5.3 (3383c37e1f9e9b3bc3df5050c29c8aff9f295297;
2018-02-24T19:49:05Z)
Maven home: /opt/local/share/java/maven3
Java version: 9.0.4, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk/Contents/Home
Default locale: en_GB, platform encoding: UTF-8
OS name: "mac os x", version: "10.13.4", arch: "x86_64", family: "mac"
$ mvn -Dmaven.tests.skip=true -DskipTests=true clean package 2>&1
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------< com.io7m.minimal:com.io7m.minimal >------------------
[INFO] Building com.io7m.minimal 0.0.1
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ com.io7m.minimal ---
[INFO] Deleting /Users/john/projects/tmp/maven-minimal-20180413/target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @
com.io7m.minimal ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered
resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory
/Users/john/projects/tmp/maven-minimal-20180413/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) @
com.io7m.minimal ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding
UTF-8, i.e. build is platform dependent!
[INFO] Compiling 1 source file to
/Users/john/projects/tmp/maven-minimal-20180413/target/classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources
(default-testResources) @ com.io7m.minimal ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered
resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory
/Users/john/projects/tmp/maven-minimal-20180413/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.7.0:testCompile
(default-testCompile) @ com.io7m.minimal ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @
com.io7m.minimal ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ com.io7m.minimal ---
[INFO] Building jar:
/Users/john/projects/tmp/maven-minimal-20180413/target/com.io7m.minimal-0.0.1.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.515 s
[INFO] Finished at: 2018-04-14T11:13:18+01:00
[INFO] ------------------------------------------------------------------------
$ mvn -Dmaven.tests.skip=true -DskipTests=true clean package 2>&1
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------< com.io7m.minimal:com.io7m.minimal >------------------
[INFO] Building com.io7m.minimal 0.0.1
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ com.io7m.minimal ---
[INFO] Deleting /Users/john/projects/tmp/maven-minimal-20180413/target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @
com.io7m.minimal ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered
resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory
/Users/john/projects/tmp/maven-minimal-20180413/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) @
com.io7m.minimal ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding
UTF-8, i.e. build is platform dependent!
[INFO] Compiling 1 source file to
/Users/john/projects/tmp/maven-minimal-20180413/target/classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources
(default-testResources) @ com.io7m.minimal ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered
resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory
/Users/john/projects/tmp/maven-minimal-20180413/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.7.0:testCompile
(default-testCompile) @ com.io7m.minimal ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @
com.io7m.minimal ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ com.io7m.minimal ---
[INFO] Building jar:
/Users/john/projects/tmp/maven-minimal-20180413/target/com.io7m.minimal-0.0.1.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.576 s
[INFO] Finished at: 2018-04-14T11:13:23+01:00
[INFO] ------------------------------------------------------------------------
$ mvn -Dmaven.tests.skip=true -DskipTests=true clean package 2>&1

In my view maven can always be made faster, once all of maven and it's
plugins are using java modules, what is loaded into memory will be
reduced and it will naturally get faster.

John


On 14 April 2018 at 10:42, Tibor Digana <ti...@apache.org> wrote:
> This is interesting discussion and so I decided to build your project with
> Java 9 and Maven 3.5.3.
> Completed within 1.5 sec.
> I have noticed that Maven 3.3.9 was slower, cca 2.5 sec.
>
> mvn -V test
> Apache Maven 3.5.3 (3383c37e1f9e9b3bc3df5050c29c8aff9f295297;
> 2018-02-24T20:49:05+01:00)
> Maven home: D:\apache-maven-3.5.3
> Java version: 9.0.1, vendor: Oracle Corporation
> Java home: e:\Program Files\Java\jdk-9.0.1
> Default locale: en_US, platform encoding: Cp1250
> OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
> [INFO] Scanning for projects...
> [INFO]
> [INFO] -----------------< com.io7m.minimal:com.io7m.minimal
>>------------------
> [INFO] Building com.io7m.minimal 0.0.1
> [INFO] --------------------------------[ jar
> ]---------------------------------
> [INFO]
> [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @
> com.io7m.minimal ---
> [WARNING] Using platform encoding (Cp1250 actually) to copy filtered
> resources, i.e. build is platform dependent!
> [INFO] skip non existing resourceDirectory
> d:\vcs\github\maven-minimal-20180413\src\main\resources
> [INFO]
> [INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) @
> com.io7m.minimal ---
> [INFO] Nothing to compile - all classes are up to date
> [INFO]
> [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources)
> @ com.io7m.minimal ---
> [WARNING] Using platform encoding (Cp1250 actually) to copy filtered
> resources, i.e. build is platform dependent!
> [INFO] skip non existing resourceDirectory
> d:\vcs\github\maven-minimal-20180413\src\test\resources
> [INFO]
> [INFO] --- maven-compiler-plugin:3.7.0:testCompile (default-testCompile) @
> com.io7m.minimal ---
> [INFO] No sources to compile
> [INFO]
> [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @
> com.io7m.minimal ---
> [INFO] No tests to run.
> [INFO]
> ------------------------------------------------------------------------
> [INFO] BUILD SUCCESS
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Total time: 1.450 s
> [INFO] Finished at: 2018-04-14T11:36:37+02:00
> [INFO]
> ------------------------------------------------------------------------
>
> On Fri, Apr 13, 2018 at 9:20 PM, Mark Raynsford <
> org.apache.maven.user@io7m.com> wrote:
>
>> Hello.
>>
>> Is there any way I might speed up Maven? I've been using it for years
>> and, for the first time, I'm actually executing it from an IDE rather
>> than using the IDE's built-in compiler. It seems like there's a rather
>> large and apparently fixed amount of overhead per invocation. Take the
>> following "could not be simpler" project:
>>
>>   https://github.com/io7m/maven-minimal-20180413
>>
>> I piped the output through tai64n [1] to give a better indication of
>> exactly how long everything is taking. That's a project that compiles a
>> single Java file and produces a jar. It doesn't run any tests, it
>> doesn't include any resources. 16 seconds total execution [2]!
>>
>> Now for an infrequent command-line build, that's not *too* obnoxious.
>> For a "click a button in the IDE because I want to try this bit of code
>> now" build, that's a world of suffering.
>>
>> It seems like Maven first spends ten entire seconds doing not very
>> much. That cannot be attributed to JVM startup time (Hello World on my
>> system takes about 100ms to reach user code, and even the largest Java
>> application I still takes less than a second to reach user code after
>> all the classes have loaded).
>>
>> Is there anything I can do to cut this down? If not, is this something
>> that's intended to be addressed in the near future?
>>
>> [1] http://cr.yp.to/daemontools/tai64n.html
>> [2] The Maven output claims 6 seconds, but that doesn't include the
>>     time it took for the build to start.
>>
>> --
>> Mark Raynsford | http://www.io7m.com
>>
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: Speeding up Maven

Posted by Tibor Digana <ti...@apache.org>.
This is interesting discussion and so I decided to build your project with
Java 9 and Maven 3.5.3.
Completed within 1.5 sec.
I have noticed that Maven 3.3.9 was slower, cca 2.5 sec.

mvn -V test
Apache Maven 3.5.3 (3383c37e1f9e9b3bc3df5050c29c8aff9f295297;
2018-02-24T20:49:05+01:00)
Maven home: D:\apache-maven-3.5.3
Java version: 9.0.1, vendor: Oracle Corporation
Java home: e:\Program Files\Java\jdk-9.0.1
Default locale: en_US, platform encoding: Cp1250
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------< com.io7m.minimal:com.io7m.minimal
>------------------
[INFO] Building com.io7m.minimal 0.0.1
[INFO] --------------------------------[ jar
]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @
com.io7m.minimal ---
[WARNING] Using platform encoding (Cp1250 actually) to copy filtered
resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory
d:\vcs\github\maven-minimal-20180413\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) @
com.io7m.minimal ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources)
@ com.io7m.minimal ---
[WARNING] Using platform encoding (Cp1250 actually) to copy filtered
resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory
d:\vcs\github\maven-minimal-20180413\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.7.0:testCompile (default-testCompile) @
com.io7m.minimal ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @
com.io7m.minimal ---
[INFO] No tests to run.
[INFO]
------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 1.450 s
[INFO] Finished at: 2018-04-14T11:36:37+02:00
[INFO]
------------------------------------------------------------------------

On Fri, Apr 13, 2018 at 9:20 PM, Mark Raynsford <
org.apache.maven.user@io7m.com> wrote:

> Hello.
>
> Is there any way I might speed up Maven? I've been using it for years
> and, for the first time, I'm actually executing it from an IDE rather
> than using the IDE's built-in compiler. It seems like there's a rather
> large and apparently fixed amount of overhead per invocation. Take the
> following "could not be simpler" project:
>
>   https://github.com/io7m/maven-minimal-20180413
>
> I piped the output through tai64n [1] to give a better indication of
> exactly how long everything is taking. That's a project that compiles a
> single Java file and produces a jar. It doesn't run any tests, it
> doesn't include any resources. 16 seconds total execution [2]!
>
> Now for an infrequent command-line build, that's not *too* obnoxious.
> For a "click a button in the IDE because I want to try this bit of code
> now" build, that's a world of suffering.
>
> It seems like Maven first spends ten entire seconds doing not very
> much. That cannot be attributed to JVM startup time (Hello World on my
> system takes about 100ms to reach user code, and even the largest Java
> application I still takes less than a second to reach user code after
> all the classes have loaded).
>
> Is there anything I can do to cut this down? If not, is this something
> that's intended to be addressed in the near future?
>
> [1] http://cr.yp.to/daemontools/tai64n.html
> [2] The Maven output claims 6 seconds, but that doesn't include the
>     time it took for the build to start.
>
> --
> Mark Raynsford | http://www.io7m.com
>
>