use of org.openjdk.jmh.annotations.Setup in project jabref by JabRef.
the class Benchmarks method init.
@Setup
public void init() throws Exception {
Globals.prefs = JabRefPreferences.getInstance();
Random randomizer = new Random();
for (int i = 0; i < 1000; i++) {
BibEntry entry = new BibEntry();
entry.setCiteKey("id" + i);
entry.setField("title", "This is my title " + i);
entry.setField("author", "Firstname Lastname and FirstnameA LastnameA and FirstnameB LastnameB" + i);
entry.setField("journal", "Journal Title " + i);
entry.setField("keyword", "testkeyword");
entry.setField("year", "1" + i);
entry.setField("rnd", "2" + randomizer.nextInt());
database.insertEntry(entry);
}
BibtexDatabaseWriter<StringSaveSession> databaseWriter = new BibtexDatabaseWriter<>(StringSaveSession::new);
StringSaveSession saveSession = databaseWriter.savePartOfDatabase(new BibDatabaseContext(database, new MetaData(), new Defaults()), database.getEntries(), new SavePreferences());
bibtexString = saveSession.getStringValue();
latexConversionString = "{A} \\textbf{bold} approach {\\it to} ${{\\Sigma}}{\\Delta}$ modulator \\textsuperscript{2} \\$";
htmlConversionString = "<b>Österreich</b> – & characters ⪢ <i>italic</i>";
}
use of org.openjdk.jmh.annotations.Setup in project hive by apache.
the class ColumnarStorageBench method prepareInvocation.
/**
* This method is invoked before every call to the methods to test. It creates
* resources that are needed for each call (not in a benchmark level).
*
* @throws IOException If it cannot writes temporary files.
*/
@Setup(Level.Invocation)
public void prepareInvocation() throws Exception {
recordWriterFile = createTempFile();
recordWriterPath = new Path(recordWriterFile.getPath());
recordWriter = storageFormatTest.getRecordWriter(writePath);
recordReader = storageFormatTest.getRecordReader(readPath);
}
use of org.openjdk.jmh.annotations.Setup in project hive by apache.
the class VectorGroupByOperatorBench method setup.
@Setup
public void setup() {
try {
dataType = dataType.replaceAll("_", ",");
TypeInfo typeInfo = TypeInfoFactory.getPrimitiveTypeInfo(dataType);
ColumnVector cv = ColumnVectorGenUtil.generateColumnVector(typeInfo, hasNulls, isRepeating, size, rand);
TypeDescription typeDescription = TypeDescription.fromString(dataType);
vrb = typeDescription.createRowBatch(size);
vrb.size = size;
vrb.cols[0] = cv;
VectorizationContext ctx = new VectorizationContext("name", ImmutableList.of("A"));
GroupByDesc desc = buildGroupByDescType(aggregation, evalMode, "A", typeInfo, processMode);
Operator<? extends OperatorDesc> groupByOp = OperatorFactory.get(new CompilationOpContext(), desc);
VectorGroupByDesc vectorGroupByDesc = new VectorGroupByDesc();
vectorGroupByDesc.setProcessingMode(ProcessingMode.HASH);
vgo = (VectorGroupByOperator) Vectorizer.vectorizeGroupByOperator(groupByOp, ctx, vectorGroupByDesc);
vgo.initialize(new Configuration(), null);
} catch (Exception e) {
// likely unsupported combination of params
// https://bugs.openjdk.java.net/browse/CODETOOLS-7901296 is not available yet to skip benchmark cleanly
System.out.println("Skipping.. Exception: " + e.getMessage());
System.exit(0);
}
}
use of org.openjdk.jmh.annotations.Setup in project ignite by apache.
the class JmhCacheAbstractBenchmark method setup.
/**
* Setup routine. Child classes must invoke this method first.
*
* @throws Exception If failed.
*/
@Setup
public void setup() throws Exception {
System.out.println();
System.out.println("--------------------");
System.out.println("IGNITE BENCHMARK INFO: ");
System.out.println("\tclient mode: " + booleanProperty(PROP_CLIENT_MODE));
System.out.println("\tdata nodes: " + intProperty(PROP_DATA_NODES, DFLT_DATA_NODES));
System.out.println("\tbackups: " + intProperty(PROP_BACKUPS));
System.out.println("\tatomicity mode: " + enumProperty(PROP_ATOMICITY_MODE, CacheAtomicityMode.class));
System.out.println("\twrite synchronization mode: " + enumProperty(PROP_WRITE_SYNC_MODE, CacheWriteSynchronizationMode.class));
System.out.println("--------------------");
System.out.println();
int nodesCnt = intProperty(PROP_DATA_NODES, DFLT_DATA_NODES);
A.ensure(nodesCnt >= 1, "nodesCnt >= 1");
node = Ignition.start(configuration("node0"));
for (int i = 1; i < nodesCnt; i++) Ignition.start(configuration("node" + i));
boolean isClient = booleanProperty(PROP_CLIENT_MODE);
if (isClient) {
IgniteConfiguration clientCfg = configuration("client");
clientCfg.setClientMode(true);
node = Ignition.start(clientCfg);
}
cache = node.cache(DEFAULT_CACHE_NAME);
}
use of org.openjdk.jmh.annotations.Setup in project gradle by gradle.
the class FileMetadataAccessorBenchmark method prepare.
@Setup
public void prepare() throws IOException {
accessor = getAccessor(accessorClassName);
missing = new File(UUID.randomUUID().toString());
missingPath = missing.toPath();
directory = File.createTempFile("jmh", "dir");
directoryPath = directory.toPath();
directory.mkdirs();
realFile = File.createTempFile("jmh", "tmp");
realFilePath = realFile.toPath();
FileOutputStream fos = new FileOutputStream(realFile);
fos.write(new byte[1024]);
fos.close();
}
Aggregations