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();
}
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());
}
}
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);
}
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();
}
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;
}
});
}
Aggregations