mirror of https://github.com/apache/lucene.git
Removed print statements for debugging stages
This commit is contained in:
parent
fdca13f77a
commit
b2c45e53b8
|
@ -79,7 +79,7 @@ public class DocIdEncodingBenchmark {
|
|||
@Param({"Bit21With3StepsEncoder", "Bit21With2StepsEncoder", "Bit24Encoder", "Bit21HybridEncoder"})
|
||||
String encoderName;
|
||||
|
||||
@Param({"decode"})
|
||||
@Param({"encode", "decode"})
|
||||
String methodName;
|
||||
|
||||
private DocIdEncoder docIdEncoder;
|
||||
|
@ -92,19 +92,16 @@ public class DocIdEncodingBenchmark {
|
|||
|
||||
@Setup(Level.Trial)
|
||||
public void init() throws IOException {
|
||||
print("Starting setup of DocId encoding benchmark");
|
||||
tmpDir = Files.createTempDirectory("docIdJmh");
|
||||
docIdEncoder = DocIdEncoder.SingletonFactory.fromName(encoderName);
|
||||
decoderInputFile =
|
||||
String.join("_", "docIdJmhData", docIdEncoder.getClass().getSimpleName(), "DecoderInput");
|
||||
// Create a file for decoders ( once per trial ) to read in every JMH iteration
|
||||
if (methodName.equalsIgnoreCase("decode")) {
|
||||
print("Generating the decoder input file %s", decoderInputFile);
|
||||
try (Directory dir = FSDirectory.open(tmpDir);
|
||||
IndexOutput out = dir.createOutput(decoderInputFile, IOContext.DEFAULT)) {
|
||||
encode(out, docIdEncoder, DOC_ID_SEQUENCES, INPUT_SCALE_FACTOR);
|
||||
}
|
||||
print("Generated the decoder input file %s", decoderInputFile);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -134,15 +131,10 @@ public class DocIdEncodingBenchmark {
|
|||
} else if (methodName.equalsIgnoreCase("decode")) {
|
||||
try (Directory dir = FSDirectory.open(tmpDir);
|
||||
IndexInput in = dir.openInput(decoderInputFile, IOContext.DEFAULT)) {
|
||||
int count = 0;
|
||||
for (int[] docIdSequence : DOC_ID_SEQUENCES) {
|
||||
for (int i = 1; i <= INPUT_SCALE_FACTOR; i++) {
|
||||
docIdEncoder.decode(in, 0, docIdSequence.length, scratch);
|
||||
}
|
||||
count++;
|
||||
if (count % 10_00_000 == 0) {
|
||||
print("Decoded %s million docId sequences", count);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -542,7 +534,6 @@ public class DocIdEncodingBenchmark {
|
|||
|
||||
try {
|
||||
String inputFilePath = System.getProperty("docIdEncoding.inputFile");
|
||||
print("Loading all docId sequences into memory");
|
||||
if (inputFilePath != null && !inputFilePath.isEmpty()) {
|
||||
DOC_ID_SEQUENCES =
|
||||
new DocIdsFromLocalFS()
|
||||
|
@ -552,22 +543,9 @@ public class DocIdEncodingBenchmark {
|
|||
new FixedBPVRandomDocIdProvider()
|
||||
.getDocIds(DocIdEncoder.Bit21With3StepsEncoder.class, 100, 100, 512);
|
||||
}
|
||||
print("Loaded all docId sequences of length %s", DOC_ID_SEQUENCES.size());
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static void print(String message, Object... args) {
|
||||
StringBuilder messageToPrint = new StringBuilder();
|
||||
messageToPrint.append("[");
|
||||
messageToPrint.append(LocalDateTime.now().format(DATE_TIME_FORMATTER));
|
||||
messageToPrint.append("] ");
|
||||
if (args != null) {
|
||||
messageToPrint.append(String.format(message, args));
|
||||
} else {
|
||||
messageToPrint.append(message);
|
||||
}
|
||||
System.out.println(messageToPrint);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue