use of org.openjdk.jmh.annotations.Setup in project crate by crate.
the class LuceneBatchIteratorBenchmark method createLuceneBatchIterator.
@Setup
public void createLuceneBatchIterator() throws Exception {
IndexWriter iw = new IndexWriter(new ByteBuffersDirectory(), new IndexWriterConfig(new StandardAnalyzer()));
String columnName = "x";
for (int i = 0; i < 10_000_000; i++) {
Document doc = new Document();
doc.add(new NumericDocValuesField(columnName, i));
iw.addDocument(doc);
}
iw.commit();
iw.forceMerge(1, true);
indexSearcher = new IndexSearcher(DirectoryReader.open(iw));
IntegerColumnReference columnReference = new IntegerColumnReference(columnName);
columnRefs = Collections.singletonList(columnReference);
collectorContext = new CollectorContext();
}
use of org.openjdk.jmh.annotations.Setup in project crate by crate.
the class JsonReaderBenchmark method create_temp_file_and_uri.
@Setup
public void create_temp_file_and_uri() throws IOException {
NodeContext nodeCtx = new NodeContext(new Functions(Map.of()));
inputFactory = new InputFactory(nodeCtx);
tempFile = File.createTempFile("temp", null);
fileUri = tempFile.toURI().getPath();
try (OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(tempFile), StandardCharsets.UTF_8)) {
writer.write("{\"name\": \"Arthur\", \"id\": 4\\n");
writer.write("{\"id\": 5, \"name\": \"Trillian\"\n");
writer.write("{\"id\": 5, \"name\": \"Emma\"\n");
writer.write("{\"id\": 9, \"name\": \"Emily\"\n");
writer.write("{\"id\": 5, \"name\": \"Sarah\"\n");
writer.write("{\"id\": 5, \"name\": \"John\"\n");
writer.write("{\"id\": 9, \"name\": \"Mical\"\n");
writer.write("{\"id\": 5, \"name\": \"Mary\"\n");
writer.write("{\"id\": 9, \"name\": \"Jimmy\"\n");
writer.write("{\"id\": 5, \"name\": \"Tom\"\n");
writer.write("{\"id\": 0, \"name\": \"Neil\"\n");
writer.write("{\"id\": 5, \"name\": \"Rose\"\n");
writer.write("{\"id\": 5, \"name\": \"Gobnait\"\n");
writer.write("{\"id\": 1, \"name\": \"Rory\"\n");
writer.write("{\"id\": 11, \"name\": \"Martin\"\n");
writer.write("{\"id\": 5, \"name\": \"Trillian\"\n");
writer.write("{\"id\": 5, \"name\": \"Emma\"\n");
writer.write("{\"id\": 9, \"name\": \"Emily\"\n");
writer.write("{\"id\": 5, \"name\": \"Sarah\"\n");
writer.write("{\"id\": 5, \"name\": \"John\"\n");
writer.write("{\"id\": 9, \"name\": \"Mical\"\n");
writer.write("{\"id\": 5, \"name\": \"Mary\"\n");
writer.write("{\"id\": 9, \"name\": \"Jimmy\"\n");
writer.write("{\"id\": 5, \"name\": \"Tom\"\n");
writer.write("{\"id\": 0, \"name\": \"Neil\"\n");
writer.write("{\"id\": 5, \"name\": \"Rose\"\n");
writer.write("{\"id\": 5, \"name\": \"Gobnait\"\n");
writer.write("{\"id\": 1, \"name\": \"Rory\"\n");
writer.write("{\"id\": 11, \"name\": \"Martin\"\n");
}
}
use of org.openjdk.jmh.annotations.Setup in project crate by crate.
the class RowsBatchIteratorBenchmark method setup.
@Setup
public void setup() {
rows = IntStream.range(0, 10_000_000).mapToObj(i -> new RowN(i)).collect(Collectors.toList());
Functions functions = new ModulesBuilder().add(new ExtraFunctionsModule()).createInjector().getInstance(Functions.class);
lastValueIntFunction = (WindowFunction) functions.getQualified(Signature.window(LAST_VALUE_NAME, parseTypeSignature("E"), parseTypeSignature("E")).withTypeVariableConstraints(typeVariable("E")), List.of(DataTypes.INTEGER), DataTypes.INTEGER);
}
use of org.openjdk.jmh.annotations.Setup in project druid by druid-io.
the class BasicAuthUserMapSerdeBenchmark method setup.
@Setup
public void setup() throws IOException {
smileMapper = new ObjectMapper(new SmileFactory());
userMap = new HashMap<>();
for (int i = 0; i < numUsers; i++) {
BenchmarkUser user = makeUser();
userMap.put(user.getName(), user);
}
serializedUsers = new ArrayList<>();
for (BenchmarkUser user : userMap.values()) {
byte[] serializedUser = smileMapper.writeValueAsBytes(user);
serializedUsers.add(serializedUser);
}
}
use of org.openjdk.jmh.annotations.Setup in project hive by apache.
the class ColumnarStorageBench method prepareBenchmark.
/**
* Initializes resources that will be needed for each of the benchmark tests.
*
* @throws SerDeException If it cannot initialize the desired test format.
* @throws IOException If it cannot write data to temporary files.
*/
@Setup(Level.Trial)
public void prepareBenchmark() throws SerDeException, IOException {
if (format.equalsIgnoreCase("parquet") || format.equalsIgnoreCase("parquet-vec")) {
storageFormatTest = new ParquetStorageFormatTest();
} else if (format.equalsIgnoreCase("orc")) {
storageFormatTest = new OrcStorageFormatTest();
} else {
throw new IllegalArgumentException("Invalid file format argument: " + format);
}
for (int i = 0; i < rows.length; i++) {
recordWritable[i] = storageFormatTest.serialize(rows[i], oi);
}
fs = FileSystem.getLocal(new Configuration());
writeFile = createTempFile();
writePath = new Path(writeFile.getPath());
readFile = createTempFile();
readPath = new Path(readFile.getPath());
/*
* Write a bunch of random rows that will be used for read benchmark.
*/
RecordWriter writer = storageFormatTest.getRecordWriter(readPath);
storageFormatTest.writeRecords(writer, recordWritable);
writer.close(false);
}
Aggregations