Skip to content

Commit

Permalink
bumped versions
Browse files Browse the repository at this point in the history
  • Loading branch information
kcrimson committed Sep 24, 2024
1 parent 21330fc commit 10b8484
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 21 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
- uses: actions/checkout@v4
- name: Set up JDK 22
uses: actions/setup-java@v4
with:
java-version: '17'
java-version: '22'
distribution: 'temurin'
cache: maven
- name: Build with Maven
Expand Down
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ THE POSSIBILITY OF SUCH DAMAGE.
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- JMH version to use with this project. -->
<jmh.version>1.36</jmh.version>
<jmh.version>1.37</jmh.version>
<!--Name of the benchmark Uber-JAR to generate. -->
<uberjar.name>benchmarks</uberjar.name>
</properties>
Expand All @@ -69,14 +69,14 @@ THE POSSIBILITY OF SUCH DAMAGE.
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<configuration>
<source>17</source>
<target>17</target>
<source>22</source>
<target>22</target>
</configuration>
</plugin>
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<version>2.36.0</version>
<version>2.43.0</version>
<configuration>
<java>
<palantirJavaFormat/>
Expand Down
52 changes: 52 additions & 0 deletions src/main/java/pl/symentis/jvm/SimpleBenchmark.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package pl.symentis.jvm;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import org.openjdk.jmh.annotations.*;

public class SimpleBenchmark {

@State(Scope.Benchmark)
public static class ArrayListBenchmark {
@Param({"10", "1000", "10000"})
public int arraySize;

@Param({"10"})
public int initialArraySize;

List<String> arrayList;

@Setup(Level.Trial)
public void setup() {
arrayList = new ArrayList<>(arraySize);
}
}

@State(Scope.Benchmark)
public static class LinkedListBenchmark {
@Param({"10", "1000", "10000"})
public int arraySize;

List<String> linkedList;

@Setup(Level.Trial)
public void setup() {
linkedList = new LinkedList<>();
}
}

@Benchmark
public void arrayList(ArrayListBenchmark benchmark) {
for (int i = 0; i < benchmark.arraySize; i++) {
benchmark.arrayList.add("Hello World!!!");
}
}

@Benchmark
public void linkedList(LinkedListBenchmark benchmark) {
for (int i = 0; i < benchmark.arraySize; i++) {
benchmark.linkedList.add("Hello World!!!");
}
}
}
2 changes: 1 addition & 1 deletion src/main/java/pl/symentis/jvm/jit/UncommonTrap.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public static void main(String[] argv) {
Object trap = null;
for (int i = 0; i < 400; ++i) {
for (int j = 0; j < CHUNK_SIZE; ++j) {
uncommonTrap(trap);
trap = uncommonTrap(trap);
}
if (i == 300) {
trap = new Object();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
package pl.symentis.jvm.microbenchmarks.autovector;

import java.util.Random;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Fork;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Measurement;
import org.openjdk.jmh.annotations.Param;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.Warmup;
import org.openjdk.jmh.annotations.*;
import org.openjdk.jmh.infra.Blackhole;

@Fork(value = 1)
Expand All @@ -36,6 +28,7 @@ public void setUp() {
}

@Benchmark
@CompilerControl(CompilerControl.Mode.PRINT)
public void autoVector(Vectors iv, Blackhole bh) {
for (int i = 0; i < iv.streamSize; i++) {
iv.zs[i] = ((iv.xs[i] * iv.ys[i]) + 1) * -1;
Expand All @@ -45,6 +38,7 @@ public void autoVector(Vectors iv, Blackhole bh) {

@Fork(jvmArgsAppend = {"-XX:-UseSuperWord"})
@Benchmark
@CompilerControl(CompilerControl.Mode.PRINT)
public void noVector(Vectors iv, Blackhole bh) {
for (int i = 0; i < iv.streamSize; i++) {
iv.zs[i] = ((iv.xs[i] * iv.ys[i]) + 1) * -1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
@State(Scope.Benchmark)
public class ReentrantReadWriteCounterBenchmark {

private SynchronizedCounter counter = new SynchronizedCounter();
private ReentrantReadWriteLockCounter counter = new ReentrantReadWriteLockCounter();

@Benchmark
@Group("counter")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ public void baseline() {

@Benchmark
public void blank() {

target_blank();
}

Expand All @@ -67,7 +66,6 @@ public void dontinline() {

@Benchmark
public void inline() {

target_inline();
}

Expand Down

0 comments on commit 10b8484

Please sign in to comment.