Skip to content

Commit

Permalink
Tidy up obsolete code after testing
Browse files Browse the repository at this point in the history
We have confirmed that the new mechanisms lead to a significant (region of 20% in the small sample jmh tests in ./java/jmh we ran) performance improvement:

```
java -jar target/rocksdbjni-jmh-1.0-SNAPSHOT-benchmarks.jar multiGetList10 -p columnFamilyTestType=no_column_family -p keyCount=10000 -p multiGetSize=100 -p valueSize=64,1024
```

it is reasonable to assume that the other versions of multiGet, when we change them, will also benefit.
  • Loading branch information
alanpaxton committed Sep 26, 2023
1 parent 5632af9 commit ab49157
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 58 deletions.
28 changes: 0 additions & 28 deletions java/jmh/src/main/java/org/rocksdb/jmh/MultiGetBenchmarks.java
Original file line number Diff line number Diff line change
Expand Up @@ -198,34 +198,6 @@ public List<byte[]> multiGetList10() throws RocksDBException {
return new ArrayList<>();
}

@Benchmark
public List<byte[]> multiGetList10_intermediate() throws RocksDBException {
final int fromKeyIdx = next(multiGetSize, keyCount);
if (fromKeyIdx >= 0) {
final List<byte[]> keys = keys(fromKeyIdx, fromKeyIdx + multiGetSize);
final List<byte[]> valueResults = db.multiGetAsList_intermediate(keys);
for (final byte[] result : valueResults) {
if (result.length != valueSize)
throw new RuntimeException("Test valueSize assumption wrong");
}
}
return new ArrayList<>();
}

@Benchmark
public List<byte[]> multiGetList10_old() throws RocksDBException {
final int fromKeyIdx = next(multiGetSize, keyCount);
if (fromKeyIdx >= 0) {
final List<byte[]> keys = keys(fromKeyIdx, fromKeyIdx + multiGetSize);
final List<byte[]> valueResults = db.multiGetAsList_old(keys);
for (final byte[] result : valueResults) {
if (result.length != valueSize)
throw new RuntimeException("Test valueSize assumption wrong");
}
}
return new ArrayList<>();
}

@Benchmark
public List<byte[]> multiGet20() throws RocksDBException {
final int fromKeyIdx = next(multiGetSize, keyCount);
Expand Down
30 changes: 0 additions & 30 deletions java/src/main/java/org/rocksdb/RocksDB.java
Original file line number Diff line number Diff line change
Expand Up @@ -2147,36 +2147,6 @@ public List<byte[]> multiGetAsList(final List<byte[]> keys)
keyLengths));
}

public List<byte[]> multiGetAsList_intermediate(final List<byte[]> keys)
throws RocksDBException {
assert(keys.size() != 0);

final byte[][] keysArray = keys.toArray(new byte[keys.size()][]);
final int[] keyOffsets = new int[keysArray.length];
final int[] keyLengths = new int[keysArray.length];
for(int i = 0; i < keyLengths.length; i++) {
keyLengths[i] = keysArray[i].length;
}

return Arrays.asList(multiGetIntermediate(nativeHandle_, keysArray, keyOffsets,
keyLengths));
}

public List<byte[]> multiGetAsList_old(final List<byte[]> keys)
throws RocksDBException {
assert(keys.size() != 0);

final byte[][] keysArray = keys.toArray(new byte[keys.size()][]);
final int[] keyOffsets = new int[keysArray.length];
final int[] keyLengths = new int[keysArray.length];
for(int i = 0; i < keyLengths.length; i++) {
keyLengths[i] = keysArray[i].length;
}

return Arrays.asList(multiGetOld(nativeHandle_, keysArray, keyOffsets,
keyLengths));
}

/**
* Returns a list of values for the given list of keys. List will contain
* null for keys which could not be found.
Expand Down

0 comments on commit ab49157

Please sign in to comment.