Skip to content

Commit

Permalink
Fold benchmarks into the main project.
Browse files Browse the repository at this point in the history
  • Loading branch information
jchambers committed Feb 5, 2021
1 parent 1e12333 commit 0800bfe
Show file tree
Hide file tree
Showing 4 changed files with 114 additions and 181 deletions.
176 changes: 0 additions & 176 deletions benchmark/pom.xml

This file was deleted.

89 changes: 86 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,20 @@
<version>4.13.1</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-core</artifactId>
<version>1.21</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-generator-annprocess</artifactId>
<version>1.21</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand All @@ -51,11 +65,29 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<version>3.8.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<source>1.7</source>
<target>1.7</target>
</configuration>

<executions>
<execution>
<goals>
<goal>testCompile</goal>
</goals>

<configuration>
<annotationProcessorPaths>
<path>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-generator-annprocess</artifactId>
<version>1.21</version>
</path>
</annotationProcessorPaths>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
Expand All @@ -81,6 +113,57 @@
<show>public</show>
</configuration>
</plugin>

<!-- Add benchmarks as a source directory -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>add-test-source</id>
<phase>generate-test-sources</phase>
<goals>
<goal>add-test-source</goal>
</goals>
<configuration>
<sources>
<source>src/benchmark/java</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.1.1</version>

<configuration>
<descriptors>
<descriptor>src/assembly/benchmark.xml</descriptor>
</descriptors>
</configuration>

<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<attach>true</attach>
<archive>
<manifest>
<mainClass>org.openjdk.jmh.Main</mainClass>
</manifest>
</archive>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down
26 changes: 26 additions & 0 deletions src/assembly/benchmark.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
<id>benchmark</id>
<formats>
<format>jar</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
<outputDirectory>/</outputDirectory>
<useProjectArtifact>true</useProjectArtifact>
<unpack>true</unpack>
<scope>test</scope>
</dependencySet>
</dependencySets>
<fileSets>
<fileSet>
<directory>${project.build.directory}/test-classes</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>**/*</include>
</includes>
<useDefaultExcludes>true</useDefaultExcludes>
</fileSet>
</fileSets>
</assembly>
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ public class UUIDBenchmark {

private static final int PREGENERATED_UUID_COUNT = 100_000;

private UUID[] uuids = new UUID[PREGENERATED_UUID_COUNT];
private String[] uuidStrings = new String[PREGENERATED_UUID_COUNT];
private final UUID[] uuids = new UUID[PREGENERATED_UUID_COUNT];
private final String[] uuidStrings = new String[PREGENERATED_UUID_COUNT];

private int i = 0;

Expand Down

0 comments on commit 0800bfe

Please sign in to comment.