Skip to content

Commit

Permalink
refactor front-coded into static classes instead of using functional …
Browse files Browse the repository at this point in the history
…interfaces (apache#14572)

* refactor front-coded into static classes instead of using functional interfaces

* shared v0 static method instead of copy
  • Loading branch information
clintropolis authored Aug 4, 2023
1 parent d6c73ca commit e5661a3
Show file tree
Hide file tree
Showing 3 changed files with 344 additions and 356 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,10 @@ public class FrontCodedIndexedBenchmark

@Param({
"generic",
"front-coded-4",
"front-coded-16",
"front-coded-incremental-buckets-4",
"front-coded-incremental-buckets-16"
"front-coded-v0-4",
"front-coded-v0-16",
"front-coded-v1-4",
"front-coded-v1-16"
})
public String indexType;

Expand Down Expand Up @@ -138,15 +138,15 @@ public void createIndex() throws IOException
FrontCodedIndexedWriter frontCodedIndexedWriter = new FrontCodedIndexedWriter(
new OnHeapMemorySegmentWriteOutMedium(),
ByteOrder.nativeOrder(),
"front-coded-4".equals(indexType) ? 4 : 16,
"front-coded-v0-4".equals(indexType) ? 4 : 16,
FrontCodedIndexed.V0
);
frontCodedIndexedWriter.open();

FrontCodedIndexedWriter frontCodedIndexedWriterIncrementalBuckets = new FrontCodedIndexedWriter(
new OnHeapMemorySegmentWriteOutMedium(),
ByteOrder.nativeOrder(),
"front-coded-incremental-buckets-4".equals(indexType) ? 4 : 16,
"front-coded-v1-4".equals(indexType) ? 4 : 16,
FrontCodedIndexed.V1
);
frontCodedIndexedWriterIncrementalBuckets.open();
Expand All @@ -166,11 +166,11 @@ public void createIndex() throws IOException
fileGeneric = File.createTempFile("genericIndexedBenchmark", "meta");

smooshDirFrontCodedIncrementalBuckets = FileUtils.createTempDir();
fileFrontCodedIncrementalBuckets = File.createTempFile("frontCodedIndexedBenchmarkIncrementalBuckets", "meta");
fileFrontCodedIncrementalBuckets = File.createTempFile("frontCodedIndexedBenchmarkv1Buckets", "meta");

EncodingSizeProfiler.encodedSize = (int) ("generic".equals(indexType)
? genericIndexedWriter.getSerializedSize()
: indexType.startsWith("front-coded-incremental-buckets")
: indexType.startsWith("front-coded-v1")
? frontCodedIndexedWriterIncrementalBuckets.getSerializedSize()
: frontCodedIndexedWriter.getSerializedSize());
try (
Expand Down Expand Up @@ -286,7 +286,7 @@ public void createIndex() throws IOException
}
if ("generic".equals(indexType)) {
indexed = genericIndexed.singleThreaded();
} else if (indexType.startsWith("front-coded-incremental-buckets")) {
} else if (indexType.startsWith("front-coded-v1")) {
indexed = frontCodedIndexedIncrementalBuckets;
} else {
indexed = frontCodedIndexed;
Expand Down
Loading

0 comments on commit e5661a3

Please sign in to comment.