Skip to content

Commit 00e91c1

Browse files
committed
[Java] Made perf tests run with latest JMH version (which is now an official build)
1 parent e42f0e4 commit 00e91c1

File tree

12 files changed

+19
-23
lines changed

12 files changed

+19
-23
lines changed

main/android/uk/co/real_logic/sbe/codec/java/BitUtil.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ public Constructor<?> run() throws Exception
7878
if (Modifier.isAbstract(clazz.getModifiers()))
7979
{
8080
//use this starting with api level < 18
81-
clazz = Class.forName("java.nio.ReadWriteDirectByteBuffer");
82-
constructor = clazz.getDeclaredConstructor(int.class, int.class);
81+
final Class<?> rwClazz = Class.forName("java.nio.ReadWriteDirectByteBuffer");
82+
constructor = rwClazz.getDeclaredConstructor(int.class, int.class);
8383
}
8484
else
8585
{

perf-build.xml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -78,25 +78,20 @@
7878
</javac>
7979

8080
<jar destfile="${dir.target.perf.dist}/microbenchmarks.jar">
81-
<manifest>
82-
<attribute name="Main-Class" value="org.openjdk.jmh.Main"/>
83-
</manifest>
8481
<fileset dir="${dir.target.perf.classes}" includes="**/*"/>
85-
<zipgroupfileset dir="target/dist" includes="**/sbe.jar"/>
86-
<zipgroupfileset dir="perf/lib" includes="**/*.jar"/>
8782
</jar>
8883
</target>
8984

9085
<target name="java:perf:test" depends="java:compile">
91-
<exec executable="java" failonerror="true">
92-
<arg value="-jar"/>
93-
<arg value="target/perf/dist/microbenchmarks.jar"/>
86+
<java classname="org.openjdk.jmh.Main" failonerror="true" fork="true">
87+
<classpath refid="perf.tools.classpath"/>
88+
<classpath path="${dir.target.perf.dist}/microbenchmarks.jar"/>
9489
<arg value="-wi"/>
9590
<arg value="3"/>
9691
<arg value="-i"/>
9792
<arg value="3"/>
9893
<arg value=".*Benchmark.*"/>
99-
</exec>
94+
</java>
10095
</target>
10196

10297
<target name="cpp:codegen" depends="init">

perf/java/uk/co/real_logic/protobuf/CarBenchmark.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
package uk.co.real_logic.protobuf;
1818

19-
import org.openjdk.jmh.annotations.GenerateMicroBenchmark;
19+
import org.openjdk.jmh.annotations.Benchmark;
2020
import org.openjdk.jmh.annotations.Scope;
2121
import org.openjdk.jmh.annotations.State;
2222
import uk.co.real_logic.protobuf.examples.Examples;
@@ -47,13 +47,13 @@ public static class MyState
4747
}
4848
}
4949

50-
@GenerateMicroBenchmark
50+
@Benchmark
5151
public byte[] testEncode(final MyState state) throws Exception
5252
{
5353
return encode();
5454
}
5555

56-
@GenerateMicroBenchmark
56+
@Benchmark
5757
public Examples.Car testDecode(final MyState state) throws Exception
5858
{
5959
final byte[] buffer = state.decodeBuffer;

perf/java/uk/co/real_logic/protobuf/MarketDataBenchmark.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@
1515
*/
1616
package uk.co.real_logic.protobuf;
1717

18-
import org.openjdk.jmh.annotations.GenerateMicroBenchmark;
18+
import org.openjdk.jmh.annotations.Benchmark;
1919
import org.openjdk.jmh.annotations.Scope;
2020
import org.openjdk.jmh.annotations.State;
21+
2122
import uk.co.real_logic.protobuf.fix.Fix;
2223

2324
public class MarketDataBenchmark
@@ -39,13 +40,13 @@ public static class MyState
3940
}
4041
}
4142

42-
@GenerateMicroBenchmark
43+
@Benchmark
4344
public byte[] testEncode(final MyState state) throws Exception
4445
{
4546
return encode();
4647
}
4748

48-
@GenerateMicroBenchmark
49+
@Benchmark
4950
public Fix.MarketDataIncrementalRefreshTrades testDecode(final MyState state) throws Exception
5051
{
5152
final byte[] buffer = state.decodeBuffer;

perf/java/uk/co/real_logic/sbe/CarBenchmark.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
package uk.co.real_logic.sbe;
1818

19-
import org.openjdk.jmh.annotations.GenerateMicroBenchmark;
19+
import org.openjdk.jmh.annotations.Benchmark;
2020
import org.openjdk.jmh.annotations.Scope;
2121
import org.openjdk.jmh.annotations.State;
2222
import uk.co.real_logic.sbe.examples.*;
@@ -63,7 +63,7 @@ public static class MyState
6363
}
6464
}
6565

66-
@GenerateMicroBenchmark
66+
@Benchmark
6767
public int testEncode(final MyState state)
6868
{
6969
final Car car = state.car;
@@ -76,7 +76,7 @@ public int testEncode(final MyState state)
7676
return car.size();
7777
}
7878

79-
@GenerateMicroBenchmark
79+
@Benchmark
8080
public int testDecode(final MyState state)
8181
{
8282
final Car car = state.car;

perf/java/uk/co/real_logic/sbe/MarketDataBenchmark.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616
package uk.co.real_logic.sbe;
1717

18-
import org.openjdk.jmh.annotations.GenerateMicroBenchmark;
18+
import org.openjdk.jmh.annotations.Benchmark;
1919
import org.openjdk.jmh.annotations.Scope;
2020
import org.openjdk.jmh.annotations.State;
2121
import uk.co.real_logic.sbe.codec.java.DirectBuffer;
@@ -40,7 +40,7 @@ public static class MyState
4040
}
4141
}
4242

43-
@GenerateMicroBenchmark
43+
@Benchmark
4444
public int testEncode(final MyState state)
4545
{
4646
final MarketDataIncrementalRefreshTrades marketData = state.marketData;
@@ -53,7 +53,7 @@ public int testEncode(final MyState state)
5353
return marketData.size();
5454
}
5555

56-
@GenerateMicroBenchmark
56+
@Benchmark
5757
public int testDecode(final MyState state)
5858
{
5959
final MarketDataIncrementalRefreshTrades marketData = state.marketData;

perf/lib/jmh/args4j-2.0.16.jar

-55 KB
Binary file not shown.

perf/lib/jmh/commons-math3-3.2.jar

1.61 MB
Binary file not shown.
-265 KB
Binary file not shown.

perf/lib/jmh/jmh-core-1.1.jar

384 KB
Binary file not shown.

0 commit comments

Comments
 (0)