Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,23 @@ byte fingerprintChecksum(int reps) throws Exception {
return result;
}

// HighwayFingerprint64

@Benchmark
byte highwayFingerprint64HashFunction(int reps) {
return runHashFunction(reps, Hashing.highwayFingerprint64());

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method does not exist in the Hashing class, or maybe it's not accessible due to scope or visibility issues

}

@Benchmark
byte highwayFingerprint64Checksum(int reps) throws Exception {
byte result = 0x01;
for (int i = 0; i < reps; i++) {
HashCode checksum = Hashing.highwayFingerprint64().hashBytes(testBytes, 0, testBytes.length);
result = (byte) (result ^ checksum.asLong());
}
return result;
}

// Helpers + main

private byte runHashFunction(int reps, HashFunction hashFunction) {
Expand All @@ -121,6 +138,7 @@ private byte runHashFunction(int reps, HashFunction hashFunction) {
result ^= Hashing.crc32().hashInt(reps).asBytes()[0];
result ^= Hashing.adler32().hashInt(reps).asBytes()[0];
result ^= Hashing.fingerprint2011().hashInt(reps).asBytes()[0];
result ^= Hashing.highwayFingerprint64().hashInt(reps).asBytes()[0];
for (int i = 0; i < reps; i++) {
result ^= hashFunction.hashBytes(testBytes).asBytes()[0];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,23 @@ byte fingerprintChecksum(int reps) throws Exception {
return result;
}

// HighwayFingerprint64

@Benchmark
byte highwayFingerprint64HashFunction(int reps) {
return runHashFunction(reps, Hashing.highwayFingerprint64());
}

@Benchmark
byte highwayFingerprint64Checksum(int reps) throws Exception {
byte result = 0x01;
for (int i = 0; i < reps; i++) {
HashCode checksum = Hashing.highwayFingerprint64().hashBytes(testBytes, 0, testBytes.length);
result = (byte) (result ^ checksum.asLong());
}
return result;
}

// Helpers + main

private byte runHashFunction(int reps, HashFunction hashFunction) {
Expand All @@ -121,6 +138,7 @@ private byte runHashFunction(int reps, HashFunction hashFunction) {
result ^= Hashing.crc32().hashInt(reps).asBytes()[0];
result ^= Hashing.adler32().hashInt(reps).asBytes()[0];
result ^= Hashing.fingerprint2011().hashInt(reps).asBytes()[0];
result ^= Hashing.highwayFingerprint64().hashInt(reps).asBytes()[0];
for (int i = 0; i < reps; i++) {
result ^= hashFunction.hashBytes(testBytes).asBytes()[0];
}
Expand Down
Loading