Skip to content

Commit

Permalink
strip unneeded dependencies from JMH shaded jar
Browse files Browse the repository at this point in the history
  • Loading branch information
cruftex committed Oct 14, 2021
1 parent 6d896ee commit efbebe8
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 31 deletions.
44 changes: 40 additions & 4 deletions jmh-suite/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,28 +30,40 @@
<groupId>${project.groupId}</groupId>
<artifactId>testbed</artifactId>
<version>${project.version}</version>
<!-- exclude any transitive dependency. we add the relevant targets
explicitly to keep the shaded benchmarks.jar small -->
<exclusions>
<exclusion>
<groupId>org.cache2k.benchmark</groupId>
<artifactId>traces</artifactId>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>thirdparty</artifactId>
<version>${project.version}</version>
<!-- exclude any transitive dependency. we add the relevant targets
explicitly to keep the shaded benchmarks.jar small -->
<exclusions>
<exclusion>
<groupId>com.github.ben-manes.caffeine</groupId>
<artifactId>simulator</artifactId>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>util</artifactId>
<version>${project.version}</version>
<!-- exclude any transitive dependency. we add the relevant targets
explicitly to keep the shaded benchmarks.jar small -->
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.openjdk.jmh</groupId>
Expand All @@ -64,16 +76,40 @@
<version>${jmh.version}</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.cache2k</groupId>
<artifactId>cache2k-core</artifactId>
<version>${cache2k-version}</version>
</dependency>
<!--
<dependency>
<groupId>org.cache2k</groupId>
<artifactId>cache2k-jcache</artifactId>
<version>${cache2k-version}</version>
</dependency>
-->
<dependency>
<groupId>com.github.ben-manes.caffeine</groupId>
<artifactId>caffeine</artifactId>
<version>${caffeine-version}</version>
</dependency>
<dependency>
<groupId>org.ehcache</groupId>
<artifactId>ehcache</artifactId>
<version>${ehcache3-version}</version>
</dependency>
<dependency>
<groupId>javax.cache</groupId>
<artifactId>cache-api</artifactId>
<version>1.1.0</version>
</dependency>

<dependency>
<groupId>it.unimi.dsi</groupId>
<artifactId>dsiutils</artifactId>
<version>${dsiutils-version}</version>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
* #L%
*/

import org.infinispan.util.concurrent.ConcurrentHashSet;
import org.openjdk.jmh.infra.BenchmarkParams;
import org.openjdk.jmh.infra.IterationParams;
import org.openjdk.jmh.profile.InternalProfiler;
Expand All @@ -36,6 +35,7 @@
import java.util.Collection;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.CopyOnWriteArraySet;
import java.util.concurrent.TimeUnit;

/**
Expand All @@ -51,7 +51,7 @@ public class MiscResultRecorderProfiler implements InternalProfiler {
* Collection of multiple results per metric, possibly multiple for an iteration,
* e.g. reported by threads
*/
static final ConcurrentHashSet<Result<?>> resultSet = new ConcurrentHashSet<>();
static final Collection<Result<?>> resultSet = new CopyOnWriteArraySet<>();
/**
* Collection of a single result per metric
*/
Expand Down
14 changes: 3 additions & 11 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<cache2k-version>2.2.1.Final</cache2k-version>
<ehcache3-version>3.9.6</ehcache3-version>
<caffeine-version>3.0.4</caffeine-version>
<dsiutils-version>2.6.0</dsiutils-version>
</properties>

<modules>
Expand All @@ -40,17 +43,6 @@
</modules>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<version>1.2.1</version>
<scope>test</scope>
</dependency>
</dependencies>

<profiles>
Expand Down
11 changes: 11 additions & 0 deletions testbed/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,17 @@
<artifactId>jackson-databind</artifactId>
<version>2.1.3</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<version>1.2.1</version>
<scope>test</scope>
</dependency>

</dependencies>

Expand Down
17 changes: 4 additions & 13 deletions thirdparty/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@

<name>Benchmarks: third party products.</name>

<properties>
<caffeine.version>3.0.4</caffeine.version>
</properties>

<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
Expand All @@ -38,15 +34,10 @@
<artifactId>guava</artifactId>
<version>26.0-jre</version>
</dependency>
<dependency>
<groupId>org.infinispan</groupId>
<artifactId>infinispan-core</artifactId>
<version>7.1.0.CR2</version>
</dependency>
<dependency>
<groupId>org.ehcache</groupId>
<artifactId>ehcache</artifactId>
<version>3.9.6</version>
<version>${ehcache3-version}</version>
</dependency>
<dependency>
<groupId>javax.cache</groupId>
Expand All @@ -56,17 +47,17 @@
<dependency>
<groupId>com.github.ben-manes.caffeine</groupId>
<artifactId>caffeine</artifactId>
<version>${caffeine.version}</version>
<version>${caffeine-version}</version>
</dependency>
<dependency>
<groupId>com.github.ben-manes.caffeine</groupId>
<artifactId>jcache</artifactId>
<version>${caffeine.version}</version>
<version>${caffeine-version}</version>
</dependency>
<dependency>
<groupId>com.github.ben-manes.caffeine</groupId>
<artifactId>simulator</artifactId>
<version>${caffeine.version}</version>
<version>${caffeine-version}</version>
<exclusions>
<exclusion>
<groupId>org.cache2k</groupId>
Expand Down
2 changes: 1 addition & 1 deletion util/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<dependency>
<groupId>it.unimi.dsi</groupId>
<artifactId>dsiutils</artifactId>
<version>2.6.0</version>
<version>${dsiutils-version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
Expand Down

0 comments on commit efbebe8

Please sign in to comment.