Search in sources :

Example 1 with OperationsPerInvocation

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

the class BenchmarkNodeScheduler method benchmark.

@Benchmark
@OperationsPerInvocation(SPLITS)
public Object benchmark(BenchmarkData data) throws Throwable {
    List<RemoteTask> remoteTasks = ImmutableList.copyOf(data.getTaskMap().values());
    Iterator<MockRemoteTaskFactory.MockRemoteTask> finishingTask = Iterators.cycle(data.getTaskMap().values());
    Iterator<Split> splits = data.getSplits().iterator();
    Set<Split> batch = new HashSet<>();
    while (splits.hasNext() || !batch.isEmpty()) {
        Multimap<Node, Split> assignments = data.getNodeSelector().computeAssignments(batch, remoteTasks).getAssignments();
        for (Node node : assignments.keySet()) {
            MockRemoteTaskFactory.MockRemoteTask remoteTask = data.getTaskMap().get(node);
            remoteTask.addSplits(ImmutableMultimap.<PlanNodeId, Split>builder().putAll(new PlanNodeId("sourceId"), assignments.get(node)).build());
            remoteTask.startSplits(MAX_SPLITS_PER_NODE);
        }
        if (assignments.size() == batch.size()) {
            batch.clear();
        } else {
            batch.removeAll(assignments.values());
        }
        while (batch.size() < SPLIT_BATCH_SIZE && splits.hasNext()) {
            batch.add(splits.next());
        }
        finishingTask.next().finishSplits((int) Math.ceil(MAX_SPLITS_PER_NODE / 50.0));
    }
    return remoteTasks;
}
Also used : Node(com.facebook.presto.spi.Node) PrestoNode(com.facebook.presto.metadata.PrestoNode) PlanNodeId(com.facebook.presto.sql.planner.plan.PlanNodeId) ConnectorSplit(com.facebook.presto.spi.ConnectorSplit) Split(com.facebook.presto.metadata.Split) HashSet(java.util.HashSet) Benchmark(org.openjdk.jmh.annotations.Benchmark) OperationsPerInvocation(org.openjdk.jmh.annotations.OperationsPerInvocation)

Example 2 with OperationsPerInvocation

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

the class BenchmarkGroupByHash method bigintGroupByHash.

@Benchmark
@OperationsPerInvocation(POSITIONS)
public Object bigintGroupByHash(SingleChannelBenchmarkData data) {
    GroupByHash groupByHash = new BigintGroupByHash(0, data.getHashEnabled(), EXPECTED_SIZE);
    data.getPages().forEach(groupByHash::addPage);
    ImmutableList.Builder<Page> pages = ImmutableList.builder();
    PageBuilder pageBuilder = new PageBuilder(groupByHash.getTypes());
    for (int groupId = 0; groupId < groupByHash.getGroupCount(); groupId++) {
        pageBuilder.declarePosition();
        groupByHash.appendValuesTo(groupId, pageBuilder, 0);
        if (pageBuilder.isFull()) {
            pages.add(pageBuilder.build());
            pageBuilder.reset();
        }
    }
    pages.add(pageBuilder.build());
    return pageBuilder.build();
}
Also used : ImmutableList(com.google.common.collect.ImmutableList) Page(com.facebook.presto.spi.Page) PageBuilder(com.facebook.presto.spi.PageBuilder) Benchmark(org.openjdk.jmh.annotations.Benchmark) OperationsPerInvocation(org.openjdk.jmh.annotations.OperationsPerInvocation)

Example 3 with OperationsPerInvocation

use of org.openjdk.jmh.annotations.OperationsPerInvocation in project druid by druid-io.

the class IncrementalIndexRowTypeBenchmark method normalLongs.

@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MICROSECONDS)
@OperationsPerInvocation(maxRows)
public void normalLongs(Blackhole blackhole) throws Exception {
    for (int i = 0; i < maxRows; i++) {
        InputRow row = longRows.get(i);
        int rv = incIndex.add(row);
        blackhole.consume(rv);
    }
}
Also used : MapBasedInputRow(io.druid.data.input.MapBasedInputRow) InputRow(io.druid.data.input.InputRow) BenchmarkMode(org.openjdk.jmh.annotations.BenchmarkMode) Benchmark(org.openjdk.jmh.annotations.Benchmark) OperationsPerInvocation(org.openjdk.jmh.annotations.OperationsPerInvocation) OutputTimeUnit(org.openjdk.jmh.annotations.OutputTimeUnit)

Example 4 with OperationsPerInvocation

use of org.openjdk.jmh.annotations.OperationsPerInvocation in project druid by druid-io.

the class IncrementalIndexRowTypeBenchmark method normalFloats.

@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MICROSECONDS)
@OperationsPerInvocation(maxRows)
public void normalFloats(Blackhole blackhole) throws Exception {
    for (int i = 0; i < maxRows; i++) {
        InputRow row = floatRows.get(i);
        int rv = incFloatIndex.add(row);
        blackhole.consume(rv);
    }
}
Also used : MapBasedInputRow(io.druid.data.input.MapBasedInputRow) InputRow(io.druid.data.input.InputRow) BenchmarkMode(org.openjdk.jmh.annotations.BenchmarkMode) Benchmark(org.openjdk.jmh.annotations.Benchmark) OperationsPerInvocation(org.openjdk.jmh.annotations.OperationsPerInvocation) OutputTimeUnit(org.openjdk.jmh.annotations.OutputTimeUnit)

Example 5 with OperationsPerInvocation

use of org.openjdk.jmh.annotations.OperationsPerInvocation in project druid by druid-io.

the class IncrementalIndexRowTypeBenchmark method normalStrings.

@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MICROSECONDS)
@OperationsPerInvocation(maxRows)
public void normalStrings(Blackhole blackhole) throws Exception {
    for (int i = 0; i < maxRows; i++) {
        InputRow row = stringRows.get(i);
        int rv = incStrIndex.add(row);
        blackhole.consume(rv);
    }
}
Also used : MapBasedInputRow(io.druid.data.input.MapBasedInputRow) InputRow(io.druid.data.input.InputRow) BenchmarkMode(org.openjdk.jmh.annotations.BenchmarkMode) Benchmark(org.openjdk.jmh.annotations.Benchmark) OperationsPerInvocation(org.openjdk.jmh.annotations.OperationsPerInvocation) OutputTimeUnit(org.openjdk.jmh.annotations.OutputTimeUnit)

Aggregations

Benchmark (org.openjdk.jmh.annotations.Benchmark)9 OperationsPerInvocation (org.openjdk.jmh.annotations.OperationsPerInvocation)9 Page (com.facebook.presto.spi.Page)5 PageBuilder (com.facebook.presto.spi.PageBuilder)3 ImmutableList (com.google.common.collect.ImmutableList)3 InputRow (io.druid.data.input.InputRow)3 MapBasedInputRow (io.druid.data.input.MapBasedInputRow)3 BenchmarkMode (org.openjdk.jmh.annotations.BenchmarkMode)3 OutputTimeUnit (org.openjdk.jmh.annotations.OutputTimeUnit)3 Block (com.facebook.presto.spi.block.Block)2 LongBigArray (com.facebook.presto.array.LongBigArray)1 PrestoNode (com.facebook.presto.metadata.PrestoNode)1 Split (com.facebook.presto.metadata.Split)1 ConnectorSplit (com.facebook.presto.spi.ConnectorSplit)1 Node (com.facebook.presto.spi.Node)1 PlanNodeId (com.facebook.presto.sql.planner.plan.PlanNodeId)1 HashSet (java.util.HashSet)1