Moved the benchmarks class, updated README with instructions, updated… (#7650)

* Moved the benchmarks class, updated README with instructions, updated pom with build instructions for easy benchmark running

* updated README, changed wrong benchmarks.java to *.jar
This commit is contained in:
Sam Millington 2019-08-27 02:16:44 +01:00 committed by Josh Cummings
parent 7e18a82d1b
commit bfba59a42f
3 changed files with 146 additions and 32 deletions

View File

@ -1,3 +1,10 @@
### Relevant Articles: ### Relevant Articles:
- [Performance of Java Mapping Frameworks](http://www.baeldung.com/java-performance-mapping-frameworks) - [Performance of Java Mapping Frameworks](http://www.baeldung.com/java-performance-mapping-frameworks)
### Running
To run the performance benchmarks:
1: `mvn clean install`
2: `java -jar target/benchmarks.jar`

View File

@ -1,10 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.baeldung</groupId>
<artifactId>performance-tests</artifactId> <artifactId>performance-tests</artifactId>
<name>performance-tests</name> <version>1.0</version>
<packaging>jar</packaging>
<parent> <parent>
<artifactId>parent-modules</artifactId> <artifactId>parent-modules</artifactId>
@ -12,6 +13,8 @@
<version>1.0.0-SNAPSHOT</version> <version>1.0.0-SNAPSHOT</version>
</parent> </parent>
<name>performance-tests</name>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>ma.glasnost.orika</groupId> <groupId>ma.glasnost.orika</groupId>
@ -32,7 +35,16 @@
<groupId>org.mapstruct</groupId> <groupId>org.mapstruct</groupId>
<artifactId>mapstruct-jdk8</artifactId> <artifactId>mapstruct-jdk8</artifactId>
<version>${mapstruct-jdk8.version}</version> <version>${mapstruct-jdk8.version}</version>
<optional>true</optional>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/org.mapstruct/mapstruct-processor -->
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>1.2.0.Final</version>
<scope>provided</scope>
</dependency>
<dependency> <dependency>
<groupId>org.modelmapper</groupId> <groupId>org.modelmapper</groupId>
<artifactId>modelmapper</artifactId> <artifactId>modelmapper</artifactId>
@ -46,25 +58,56 @@
<dependency> <dependency>
<groupId>org.openjdk.jmh</groupId> <groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-core</artifactId> <artifactId>jmh-core</artifactId>
<version>${jmh-core.version}</version> <version>${jmh.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.openjdk.jmh</groupId> <groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-generator-annprocess</artifactId> <artifactId>jmh-generator-annprocess</artifactId>
<version>${jmh-generator.version}</version> <version>${jmh.version}</version>
<scope>provided</scope>
</dependency> </dependency>
</dependencies> </dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!--
JMH version to use with this project.
-->
<jmh.version>1.21</jmh.version>
<orika.version>1.5.2</orika.version>
<dozer.version>5.5.1</dozer.version>
<dozer-jdk8-support.version>1.0.2</dozer-jdk8-support.version>
<mapstruct-jdk8.version>1.2.0.Final</mapstruct-jdk8.version>
<modelmapper.version>1.1.0</modelmapper.version>
<jmapper.version>1.6.0.1</jmapper.version>
<java.version>1.8</java.version>
<mapstruct-processor.version>1.2.0.Final</mapstruct-processor.version>
<jmh-core.version>1.21</jmh-core.version>
<jmh-generator.version>1.21</jmh-generator.version>
<maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
<!--
Java source/target to use for compilation.
-->
<javac.target>1.8</javac.target>
<!--
Name of the benchmark Uber-JAR to generate.
-->
<uberjar.name>benchmarks</uberjar.name>
</properties>
<build> <build>
<pluginManagement>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version> <version>3.1</version>
<configuration> <configuration>
<source>${java.version}</source> <compilerVersion>${javac.target}</compilerVersion>
<target>${java.version}</target> <source>${javac.target}</source>
<target>${javac.target}</target>
<annotationProcessorPaths> <annotationProcessorPaths>
<path> <path>
<groupId>org.mapstruct</groupId> <groupId>org.mapstruct</groupId>
@ -74,18 +117,82 @@
</annotationProcessorPaths> </annotationProcessorPaths>
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<finalName>${uberjar.name}</finalName>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>org.openjdk.jmh.Main</mainClass>
</transformer>
</transformers>
<filters>
<filter>
<!--
Shading signed JARs will fail without this.
http://stackoverflow.com/questions/999489/invalid-signature-file-when-attempting-to-run-a-jar
-->
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.1</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.1</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
</plugin>
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.3</version>
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.17</version>
</plugin>
</plugins> </plugins>
</pluginManagement> </pluginManagement>
</build> </build>
<properties>
<orika.version>1.5.2</orika.version>
<dozer.version>5.5.1</dozer.version>
<dozer-jdk8-support.version>1.0.2</dozer-jdk8-support.version>
<mapstruct-jdk8.version>1.2.0.Final</mapstruct-jdk8.version>
<modelmapper.version>1.1.0</modelmapper.version>
<jmapper.version>1.6.0.1</jmapper.version>
<mapstruct-processor.version>1.2.0.Final</mapstruct-processor.version>
</properties>
</project> </project>