Explicit use of NIOFSDirectory

This commit is contained in:
expani 2024-08-06 18:36:02 +05:30
parent 5034e04eae
commit e06bc3b430
1 changed files with 2 additions and 2 deletions

View File

@ -1,10 +1,10 @@
package org.apache.lucene.benchmark.jmh; package org.apache.lucene.benchmark.jmh;
import org.apache.lucene.store.Directory; import org.apache.lucene.store.Directory;
import org.apache.lucene.store.FSDirectory;
import org.apache.lucene.store.IOContext; import org.apache.lucene.store.IOContext;
import org.apache.lucene.store.IndexInput; import org.apache.lucene.store.IndexInput;
import org.apache.lucene.store.IndexOutput; import org.apache.lucene.store.IndexOutput;
import org.apache.lucene.store.NIOFSDirectory;
import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Fork;
@ -64,7 +64,7 @@ public class DocIdEncodingBenchmark {
@Benchmark @Benchmark
public void performEncodeDecode(Blackhole blackhole) throws IOException { public void performEncodeDecode(Blackhole blackhole) throws IOException {
try (Directory dir = FSDirectory.open(TMP_DIR)) { try (Directory dir = new NIOFSDirectory(TMP_DIR)) {
String innerDirName = String.join("_", "docIdJmhData_", docIdEncoder.getClass().getSimpleName(), String.valueOf(System.nanoTime())); String innerDirName = String.join("_", "docIdJmhData_", docIdEncoder.getClass().getSimpleName(), String.valueOf(System.nanoTime()));
try (IndexOutput out = dir.createOutput(innerDirName, IOContext.DEFAULT)) { try (IndexOutput out = dir.createOutput(innerDirName, IOContext.DEFAULT)) {
for (int i = 1; i <= INPUT_SCALE_FACTOR; i++) { for (int i = 1; i <= INPUT_SCALE_FACTOR; i++) {