Skip to content

Commit

Permalink
Run Spotless for integration-tests codebase only
Browse files Browse the repository at this point in the history
Signed-off-by: Joseph Sinclair <121976561+jsync-swirlds@users.noreply.github.com>
  • Loading branch information
jsync-swirlds committed Jan 10, 2025
1 parent 7c8b490 commit 39efea5
Show file tree
Hide file tree
Showing 32 changed files with 1,538 additions and 1,470 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ public record HashevalJavaRecord(
Suit enumSuit,
@Nullable TimestampTest subObject,
String text,
Bytes bytesField
){}
Bytes bytesField) {}

private final Hasheval hasheval;
private final Hasheval hasheval1;
Expand All @@ -69,42 +68,114 @@ public record HashevalJavaRecord(
private final HashevalJavaRecord hashevalJavaRecordDifferent;

public ComplexEqualsHashCodeBench() {
hasheval = new Hasheval(123, 123, 123,
123, 123, 1.23f, 123L, 123L,
123L, 123L, 123L, 1.23D, true,
Suit.ACES, new TimestampTest(987L, 123),
hasheval = new Hasheval(
123,
123,
123,
123,
123,
1.23f,
123L,
123L,
123L,
123L,
123L,
1.23D,
true,
Suit.ACES,
new TimestampTest(987L, 123),
"FooBarKKKKHHHHOIOIOI",
Bytes.wrap(new byte[]{1, 2, 3, 4, 5, 6, 7, (byte)255}));
hasheval1 = new Hasheval(123, 123, 123,
123, 123, 1.23f, 123L, 123L,
123L, 123L, 123L, 1.23D, true,
Suit.ACES, new TimestampTest(987L, 123),
Bytes.wrap(new byte[] {1, 2, 3, 4, 5, 6, 7, (byte) 255}));
hasheval1 = new Hasheval(
123,
123,
123,
123,
123,
1.23f,
123L,
123L,
123L,
123L,
123L,
1.23D,
true,
Suit.ACES,
new TimestampTest(987L, 123),
"FooBarKKKKHHHHOIOIOI",
Bytes.wrap(new byte[]{1, 2, 3, 4, 5, 6, 7, (byte)255}));
hashevalDifferent = new Hasheval(123, 123, 123,
123, 123, 1.23f, 123L, 123L,
123L, 123L, 123L, 1.23D, true,
Suit.ACES, new TimestampTest(987L, 123),
Bytes.wrap(new byte[] {1, 2, 3, 4, 5, 6, 7, (byte) 255}));
hashevalDifferent = new Hasheval(
123,
123,
123,
123,
123,
1.23f,
123L,
123L,
123L,
123L,
123L,
1.23D,
true,
Suit.ACES,
new TimestampTest(987L, 123),
"Different",
Bytes.wrap(new byte[]{1, 2, 3, 4, 5, 6, 7, (byte)255}));
hashevalJavaRecord = new HashevalJavaRecord(123, 123, 123,
123, 123, 1.23f, 123L, 123L,
123L, 123L, 123L, 1.23D, true,
Suit.ACES, new TimestampTest(987L, 123),
Bytes.wrap(new byte[] {1, 2, 3, 4, 5, 6, 7, (byte) 255}));
hashevalJavaRecord = new HashevalJavaRecord(
123,
123,
123,
123,
123,
1.23f,
123L,
123L,
123L,
123L,
123L,
1.23D,
true,
Suit.ACES,
new TimestampTest(987L, 123),
"FooBarKKKKHHHHOIOIOI",
Bytes.wrap(new byte[]{1, 2, 3, 4, 5, 6, 7, (byte)255}));
hashevalJavaRecord1 = new HashevalJavaRecord(123, 123, 123,
123, 123, 1.23f, 123L, 123L,
123L, 123L, 123L, 1.23D, true,
Suit.ACES, new TimestampTest(987L, 123),
Bytes.wrap(new byte[] {1, 2, 3, 4, 5, 6, 7, (byte) 255}));
hashevalJavaRecord1 = new HashevalJavaRecord(
123,
123,
123,
123,
123,
1.23f,
123L,
123L,
123L,
123L,
123L,
1.23D,
true,
Suit.ACES,
new TimestampTest(987L, 123),
"FooBarKKKKHHHHOIOIOI",
Bytes.wrap(new byte[]{1, 2, 3, 4, 5, 6, 7, (byte)255}));
hashevalJavaRecordDifferent = new HashevalJavaRecord(123, 123, 123,
123, 123, 1.23f, 123L, 123L,
123L, 123L, 123L, 1.23D, true,
Suit.ACES, new TimestampTest(987L, 123),
Bytes.wrap(new byte[] {1, 2, 3, 4, 5, 6, 7, (byte) 255}));
hashevalJavaRecordDifferent = new HashevalJavaRecord(
123,
123,
123,
123,
123,
1.23f,
123L,
123L,
123L,
123L,
123L,
1.23D,
true,
Suit.ACES,
new TimestampTest(987L, 123),
"Different",
Bytes.wrap(new byte[]{1, 2, 3, 4, 5, 6, 7, (byte)255}));
Bytes.wrap(new byte[] {1, 2, 3, 4, 5, 6, 7, (byte) 255}));
}

@Benchmark
Expand All @@ -130,6 +201,7 @@ public void benchEquals(Blackhole blackhole) {
blackhole.consume(hasheval.equals(hasheval1));
}
}

@Benchmark
@OperationsPerInvocation(1050)
public void benchJavaRecordEquals(Blackhole blackhole) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,20 @@
package com.hedera.pbj.integration.jmh;

import com.hedera.pbj.test.proto.pbj.TimestampTest;
import java.util.concurrent.TimeUnit;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Fork;
import org.openjdk.jmh.annotations.Measurement;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.annotations.OperationsPerInvocation;
import org.openjdk.jmh.annotations.OutputTimeUnit;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.Scope;
// Add any other JMH annotation imports you use
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.Warmup;
import org.openjdk.jmh.infra.Blackhole;

import java.util.concurrent.TimeUnit;

/*
Mac Results
Expand All @@ -39,7 +38,7 @@
@OutputTimeUnit(TimeUnit.NANOSECONDS)
@BenchmarkMode(Mode.AverageTime)
public class EqualsHashCodeBench {
public record TimestampStandardRecord(long seconds, int nanos){}
public record TimestampStandardRecord(long seconds, int nanos) {}

private final TimestampTest testStamp;
private final TimestampTest testStamp1;
Expand Down Expand Up @@ -80,6 +79,7 @@ public void benchEquals(Blackhole blackhole) {
blackhole.consume(testStamp.equals(testStamp1));
}
}

@Benchmark
@OperationsPerInvocation(1050)
public void benchJavaRecordEquals(Blackhole blackhole) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import com.hedera.pbj.test.proto.pbj.Hasheval;
import com.hedera.pbj.test.proto.pbj.Suit;
import com.hedera.pbj.test.proto.pbj.TimestampTest;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Fork;
Expand All @@ -18,9 +20,6 @@
import org.openjdk.jmh.annotations.Warmup;
import org.openjdk.jmh.infra.Blackhole;

import java.io.IOException;
import java.util.concurrent.TimeUnit;

@SuppressWarnings("unused")
@State(Scope.Benchmark)
@Fork(1)
Expand All @@ -33,10 +32,24 @@ public class HashBench {

public HashBench() {
TimestampTest tst = new TimestampTest(987L, 123);
hasheval = new Hasheval(1, -1, 2, 3, -2,
123f, 7L, -7L, 123L, 234L,
-345L, 456.789D, true, Suit.ACES, tst, "FooBarKKKKHHHHOIOIOI",
Bytes.wrap(new byte[]{1, 2, 3, 4, 5, 6, 7, (byte)255}));
hasheval = new Hasheval(
1,
-1,
2,
3,
-2,
123f,
7L,
-7L,
123L,
234L,
-345L,
456.789D,
true,
Suit.ACES,
tst,
"FooBarKKKKHHHHOIOIOI",
Bytes.wrap(new byte[] {1, 2, 3, 4, 5, 6, 7, (byte) 255}));
}

@Benchmark
Expand Down
Loading

0 comments on commit 39efea5

Please sign in to comment.