Search in sources :

Example 21 with Setup

use of org.openjdk.jmh.annotations.Setup in project netty by netty.

the class SlicedByteBufBenchmark method setup.

@Setup
public void setup() {
    // Use buffer sizes that will also allow to write UTF-8 without grow the buffer
    ByteBuf buffer = Unpooled.buffer(512).retain();
    slicedByteBuf = buffer.slice(0, 256);
    slicedAbstractByteBuf = buffer.slice(0, 256);
    if (slicedByteBuf.getClass() == slicedAbstractByteBuf.getClass()) {
        throw new IllegalStateException();
    }
    StringBuilder asciiSequence = new StringBuilder(128);
    for (int i = 0; i < 128; i++) {
        asciiSequence.append('a');
    }
    ascii = asciiSequence.toString();
}
Also used : ByteBuf(io.netty.buffer.ByteBuf) Setup(org.openjdk.jmh.annotations.Setup)

Example 22 with Setup

use of org.openjdk.jmh.annotations.Setup in project netty by netty.

the class SwappedByteBufBenchmark method setup.

@Setup
public void setup() {
    swappedByteBuf = new SwappedByteBuf(Unpooled.directBuffer(8));
    unsafeSwappedByteBuf = Unpooled.directBuffer(8).order(ByteOrder.LITTLE_ENDIAN);
    if (unsafeSwappedByteBuf.getClass().equals(SwappedByteBuf.class)) {
        throw new IllegalStateException("Should not use " + SwappedByteBuf.class.getSimpleName());
    }
}
Also used : SwappedByteBuf(io.netty.buffer.SwappedByteBuf) Setup(org.openjdk.jmh.annotations.Setup)

Example 23 with Setup

use of org.openjdk.jmh.annotations.Setup in project presto by prestodb.

the class HiveFileFormatBenchmark method setup.

@Setup
public void setup() throws IOException {
    data = dataSet.createTestData(fileFormat);
    targetDir.mkdirs();
    dataFile = new File(targetDir, UUID.randomUUID().toString());
    writeData(dataFile);
}
Also used : File(java.io.File) Setup(org.openjdk.jmh.annotations.Setup)

Example 24 with Setup

use of org.openjdk.jmh.annotations.Setup in project presto by prestodb.

the class InCodeGeneratorBenchmark method setup.

@Setup
public void setup() {
    Random random = new Random();
    RowExpression[] arguments = new RowExpression[1 + inListCount];
    switch(type) {
        case StandardTypes.BIGINT:
            prestoType = BIGINT;
            for (int i = 1; i <= inListCount; i++) {
                arguments[i] = constant((long) random.nextInt(), BIGINT);
            }
            break;
        case StandardTypes.DOUBLE:
            prestoType = DOUBLE;
            for (int i = 1; i <= inListCount; i++) {
                arguments[i] = constant(random.nextDouble(), DOUBLE);
            }
            break;
        case StandardTypes.VARCHAR:
            prestoType = VARCHAR;
            for (int i = 1; i <= inListCount; i++) {
                arguments[i] = constant(Slices.utf8Slice(Long.toString(random.nextLong())), VARCHAR);
            }
            break;
        default:
            throw new IllegalStateException();
    }
    arguments[0] = field(0, prestoType);
    RowExpression project = field(0, prestoType);
    PageBuilder pageBuilder = new PageBuilder(ImmutableList.of(prestoType));
    for (int i = 0; i < 10_000; i++) {
        pageBuilder.declarePosition();
        switch(type) {
            case StandardTypes.BIGINT:
                BIGINT.writeLong(pageBuilder.getBlockBuilder(0), random.nextInt());
                break;
            case StandardTypes.DOUBLE:
                DOUBLE.writeDouble(pageBuilder.getBlockBuilder(0), random.nextDouble());
                break;
            case StandardTypes.VARCHAR:
                VARCHAR.writeSlice(pageBuilder.getBlockBuilder(0), Slices.utf8Slice(Long.toString(random.nextLong())));
                break;
        }
    }
    inputPage = pageBuilder.build();
    RowExpression filter = call(new Signature(IN, SCALAR, parseTypeSignature(StandardTypes.BOOLEAN)), BOOLEAN, arguments);
    processor = new ExpressionCompiler(MetadataManager.createTestMetadataManager()).compilePageProcessor(filter, ImmutableList.of(project)).get();
}
Also used : Random(java.util.Random) Signature(com.facebook.presto.metadata.Signature) TypeSignature.parseTypeSignature(com.facebook.presto.spi.type.TypeSignature.parseTypeSignature) RowExpression(com.facebook.presto.sql.relational.RowExpression) PageBuilder(com.facebook.presto.spi.PageBuilder) Setup(org.openjdk.jmh.annotations.Setup)

Example 25 with Setup

use of org.openjdk.jmh.annotations.Setup in project requery by requery.

the class BenchmarkTest method setup.

@Setup
public void setup() {
    EntityModel model = Models.DEFAULT;
    dataSource = (DataSource) DatabaseType.getDataSource(platform);
    data = new EntityDataStore<>(dataSource, model);
    new SchemaModifier(dataSource, model).createTables(TableCreationMode.DROP_CREATE);
    final int count = 10000;
    data.runInTransaction(new Callable<Object>() {

        @Override
        public Object call() throws Exception {
            for (int i = 0; i < count; i++) {
                Person person = FunctionalTest.randomPerson();
                data.insert(person);
            }
            return null;
        }
    });
}
Also used : EntityModel(io.requery.meta.EntityModel) Person(io.requery.test.model.Person) SQLException(java.sql.SQLException) RunnerException(org.openjdk.jmh.runner.RunnerException) MalformedURLException(java.net.MalformedURLException) NoBenchmarksException(org.openjdk.jmh.runner.NoBenchmarksException) SchemaModifier(io.requery.sql.SchemaModifier) Setup(org.openjdk.jmh.annotations.Setup)

Aggregations

Setup (org.openjdk.jmh.annotations.Setup)80 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