Skip to content

Commit

Permalink
fix 114: fix jmh compilation (#179)
Browse files Browse the repository at this point in the history
Signed-off-by: Anthony Petrov <anthony@swirldslabs.com>
  • Loading branch information
anthony-swirldslabs authored Jan 23, 2024
1 parent 179e110 commit 314890d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.hedera.pbj.integration.EverythingTestData;
import com.hedera.pbj.runtime.Codec;
import com.hedera.pbj.runtime.JsonCodec;
import com.hedera.pbj.runtime.ParseException;
import com.hedera.pbj.runtime.io.buffer.BufferedData;
import com.hedera.pbj.test.proto.pbj.Everything;
import com.hederahashgraph.api.proto.java.GetAccountDetailsResponse;
Expand Down Expand Up @@ -78,7 +79,7 @@ public void configure(P pbjModelObject, Codec<P> pbjProtoCodec, JsonCodec<P> pbj

/** Same as parsePbjByteBuffer because DataBuffer.wrap(byte[]) uses ByteBuffer today, added this because makes result plotting easier */
@Benchmark
public void parsePbj(JsonBenchmarkState<P,G> benchmarkState, Blackhole blackhole) throws IOException {
public void parsePbj(JsonBenchmarkState<P,G> benchmarkState, Blackhole blackhole) throws ParseException {
benchmarkState.jsonDataBuffer.position(0);
blackhole.consume(benchmarkState.pbjJsonCodec.parse(benchmarkState.jsonDataBuffer));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.hedera.pbj.integration.NonSynchronizedByteArrayInputStream;
import com.hedera.pbj.integration.NonSynchronizedByteArrayOutputStream;
import com.hedera.pbj.runtime.Codec;
import com.hedera.pbj.runtime.ParseException;
import com.hedera.pbj.runtime.io.buffer.BufferedData;
import com.hedera.pbj.runtime.io.stream.ReadableStreamingData;
import com.hedera.pbj.runtime.io.stream.WritableStreamingData;
Expand Down Expand Up @@ -101,7 +102,7 @@ public void configure(P pbjModelObject, Codec<P> pbjCodec,
/** Same as parsePbjByteBuffer because DataBuffer.wrap(byte[]) uses ByteBuffer today, added this because makes result plotting easier */
@Benchmark
@OperationsPerInvocation(OPERATION_COUNT)
public void parsePbjByteArray(BenchmarkState<P,G> benchmarkState, Blackhole blackhole) throws IOException {
public void parsePbjByteArray(BenchmarkState<P,G> benchmarkState, Blackhole blackhole) throws ParseException {
for (int i = 0; i < 1000; i++) {
benchmarkState.protobufDataBuffer.resetPosition();
blackhole.consume(benchmarkState.pbjCodec.parse(benchmarkState.protobufDataBuffer));
Expand All @@ -110,7 +111,7 @@ public void parsePbjByteArray(BenchmarkState<P,G> benchmarkState, Blackhole blac

@Benchmark
@OperationsPerInvocation(OPERATION_COUNT)
public void parsePbjByteBuffer(BenchmarkState<P,G> benchmarkState, Blackhole blackhole) throws IOException {
public void parsePbjByteBuffer(BenchmarkState<P,G> benchmarkState, Blackhole blackhole) throws ParseException {
for (int i = 0; i < 1000; i++) {
benchmarkState.protobufDataBuffer.resetPosition();
blackhole.consume(benchmarkState.pbjCodec.parse(benchmarkState.protobufDataBuffer));
Expand All @@ -119,15 +120,16 @@ public void parsePbjByteBuffer(BenchmarkState<P,G> benchmarkState, Blackhole bla

@Benchmark
@OperationsPerInvocation(OPERATION_COUNT)
public void parsePbjByteBufferDirect(BenchmarkState<P,G> benchmarkState, Blackhole blackhole) throws IOException {
public void parsePbjByteBufferDirect(BenchmarkState<P,G> benchmarkState, Blackhole blackhole)
throws ParseException {
for (int i = 0; i < 1000; i++) {
benchmarkState.protobufDataBufferDirect.resetPosition();
blackhole.consume(benchmarkState.pbjCodec.parse(benchmarkState.protobufDataBufferDirect));
}
}
@Benchmark
@OperationsPerInvocation(OPERATION_COUNT)
public void parsePbjInputStream(BenchmarkState<P,G> benchmarkState, Blackhole blackhole) throws IOException {
public void parsePbjInputStream(BenchmarkState<P,G> benchmarkState, Blackhole blackhole) throws ParseException {
for (int i = 0; i < 1000; i++) {
benchmarkState.bin.resetPosition();
blackhole.consume(benchmarkState.pbjCodec.parse(new ReadableStreamingData(benchmarkState.bin)));
Expand Down

0 comments on commit 314890d

Please sign in to comment.