mirror of https://github.com/apache/lucene.git
Avoid write/read to files per unique sequence
This commit is contained in:
parent
d751e60836
commit
b833e731dc
|
@ -101,14 +101,16 @@ public class DocIdEncodingBenchmark {
|
||||||
"docIdJmhData_",
|
"docIdJmhData_",
|
||||||
docIdEncoder.getClass().getSimpleName(),
|
docIdEncoder.getClass().getSimpleName(),
|
||||||
String.valueOf(System.nanoTime()));
|
String.valueOf(System.nanoTime()));
|
||||||
for (int[] docIdSequence : docIdSequences) {
|
try (Directory dir = new NIOFSDirectory(tmpDir)) {
|
||||||
try (Directory dir = new NIOFSDirectory(tmpDir)) {
|
try (IndexOutput out = dir.createOutput(dataFile, IOContext.DEFAULT)) {
|
||||||
try (IndexOutput out = dir.createOutput(dataFile, IOContext.DEFAULT)) {
|
for (int[] docIdSequence : docIdSequences) {
|
||||||
for (int i = 1; i <= INPUT_SCALE_FACTOR; i++) {
|
for (int i = 1; i <= INPUT_SCALE_FACTOR; i++) {
|
||||||
docIdEncoder.encode(out, 0, docIdSequence.length, docIdSequence);
|
docIdEncoder.encode(out, 0, docIdSequence.length, docIdSequence);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
try (IndexInput in = dir.openInput(dataFile, IOContext.DEFAULT)) {
|
}
|
||||||
|
try (IndexInput in = dir.openInput(dataFile, IOContext.DEFAULT)) {
|
||||||
|
for (int[] docIdSequence : docIdSequences) {
|
||||||
for (int i = 1; i <= INPUT_SCALE_FACTOR; i++) {
|
for (int i = 1; i <= INPUT_SCALE_FACTOR; i++) {
|
||||||
docIdEncoder.decode(in, 0, docIdSequence.length, scratch);
|
docIdEncoder.decode(in, 0, docIdSequence.length, scratch);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue