Search in sources :

Example 81 with Setup

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>&Ouml;sterreich</b> &#8211; &amp; characters &#x2aa2; <i>italic</i>";
}
Also used : BibEntry(org.jabref.model.entry.BibEntry) Defaults(org.jabref.model.Defaults) Random(java.util.Random) BibtexDatabaseWriter(org.jabref.logic.exporter.BibtexDatabaseWriter) MetaData(org.jabref.model.metadata.MetaData) SavePreferences(org.jabref.logic.exporter.SavePreferences) StringSaveSession(org.jabref.logic.exporter.StringSaveSession) BibDatabaseContext(org.jabref.model.database.BibDatabaseContext) Setup(org.openjdk.jmh.annotations.Setup)

Example 82 with Setup

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);
}
Also used : Path(org.apache.hadoop.fs.Path) Setup(org.openjdk.jmh.annotations.Setup)

Example 83 with Setup

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);
    }
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) CompilationOpContext(org.apache.hadoop.hive.ql.CompilationOpContext) VectorGroupByDesc(org.apache.hadoop.hive.ql.plan.VectorGroupByDesc) TypeDescription(org.apache.orc.TypeDescription) VectorizationContext(org.apache.hadoop.hive.ql.exec.vector.VectorizationContext) TypeInfo(org.apache.hadoop.hive.serde2.typeinfo.TypeInfo) VectorGroupByDesc(org.apache.hadoop.hive.ql.plan.VectorGroupByDesc) GroupByDesc(org.apache.hadoop.hive.ql.plan.GroupByDesc) SemanticException(org.apache.hadoop.hive.ql.parse.SemanticException) RunnerException(org.openjdk.jmh.runner.RunnerException) HiveException(org.apache.hadoop.hive.ql.metadata.HiveException) ColumnVector(org.apache.hadoop.hive.ql.exec.vector.ColumnVector) Setup(org.openjdk.jmh.annotations.Setup)

Example 84 with Setup

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);
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) Setup(org.openjdk.jmh.annotations.Setup)

Example 85 with Setup

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();
}
Also used : FileOutputStream(java.io.FileOutputStream) File(java.io.File) Setup(org.openjdk.jmh.annotations.Setup)

Aggregations

Setup (org.openjdk.jmh.annotations.Setup)88 File (java.io.File)19 InputRow (io.druid.data.input.InputRow)15 BenchmarkDataGenerator (io.druid.benchmark.datagen.BenchmarkDataGenerator)14 HyperUniquesSerde (io.druid.query.aggregation.hyperloglog.HyperUniquesSerde)14 Random (java.util.Random)11 IndexSpec (io.druid.segment.IndexSpec)10 IncrementalIndex (io.druid.segment.incremental.IncrementalIndex)8 OnheapIncrementalIndex (io.druid.segment.incremental.OnheapIncrementalIndex)8 QueryableIndex (io.druid.segment.QueryableIndex)7 ByteBuffer (java.nio.ByteBuffer)7 StupidPool (io.druid.collections.StupidPool)4 OffheapBufferGenerator (io.druid.offheap.OffheapBufferGenerator)4 PooledByteBufAllocator (io.netty.buffer.PooledByteBufAllocator)4 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)4 AtomicLong (java.util.concurrent.atomic.AtomicLong)4 Function (com.google.common.base.Function)3 BitmapFactory (io.druid.collections.bitmap.BitmapFactory)3 ImmutableBitmap (io.druid.collections.bitmap.ImmutableBitmap)3 MutableBitmap (io.druid.collections.bitmap.MutableBitmap)3