Search in sources :

Example 91 with BenchmarkMode

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

the class TopNBenchmark method queryMultiQueryableIndex.

@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MICROSECONDS)
public void queryMultiQueryableIndex(Blackhole blackhole) throws Exception {
    List<QueryRunner<Result<TopNResultValue>>> singleSegmentRunners = Lists.newArrayList();
    QueryToolChest toolChest = factory.getToolchest();
    for (int i = 0; i < numSegments; i++) {
        String segmentName = "qIndex" + i;
        QueryRunner<Result<TopNResultValue>> runner = QueryBenchmarkUtil.makeQueryRunner(factory, segmentName, new QueryableIndexSegment(segmentName, qIndexes.get(i)));
        singleSegmentRunners.add(toolChest.preMergeQueryDecoration(runner));
    }
    QueryRunner theRunner = toolChest.postMergeQueryDecoration(new FinalizeResultsQueryRunner<>(toolChest.mergeResults(factory.mergeRunners(executorService, singleSegmentRunners)), toolChest));
    Sequence<Result<TopNResultValue>> queryResult = theRunner.run(query, Maps.<String, Object>newHashMap());
    List<Result<TopNResultValue>> results = Sequences.toList(queryResult, Lists.<Result<TopNResultValue>>newArrayList());
    for (Result<TopNResultValue> result : results) {
        blackhole.consume(result);
    }
}
Also used : TopNResultValue(io.druid.query.topn.TopNResultValue) QueryableIndexSegment(io.druid.segment.QueryableIndexSegment) TopNQueryQueryToolChest(io.druid.query.topn.TopNQueryQueryToolChest) QueryToolChest(io.druid.query.QueryToolChest) FinalizeResultsQueryRunner(io.druid.query.FinalizeResultsQueryRunner) QueryRunner(io.druid.query.QueryRunner) Result(io.druid.query.Result) BenchmarkMode(org.openjdk.jmh.annotations.BenchmarkMode) Benchmark(org.openjdk.jmh.annotations.Benchmark) OutputTimeUnit(org.openjdk.jmh.annotations.OutputTimeUnit)

Example 92 with BenchmarkMode

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

the class BoundFilterBenchmark method matchHalfLexicographic.

@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MICROSECONDS)
public void matchHalfLexicographic() {
    final ImmutableBitmap bitmapIndex = HALF_LEXICOGRAPHIC.getBitmapIndex(selector);
    Preconditions.checkState(bitmapIndex.size() > 0 && bitmapIndex.size() < cardinality);
}
Also used : ImmutableBitmap(io.druid.collections.bitmap.ImmutableBitmap) BenchmarkMode(org.openjdk.jmh.annotations.BenchmarkMode) Benchmark(org.openjdk.jmh.annotations.Benchmark) OutputTimeUnit(org.openjdk.jmh.annotations.OutputTimeUnit)

Example 93 with BenchmarkMode

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

the class BenchmarkTest method queryJdbc.

@Benchmark
@BenchmarkMode(Mode.SingleShotTime)
public void queryJdbc() throws SQLException {
    try (Connection connection = dataSource.getConnection();
        PreparedStatement statement = connection.prepareStatement("SELECT id , name , email , birthday," + " age, homepage, uuid FROM Person LIMIT 10000 ")) {
        try (ResultSet resultSet = statement.executeQuery()) {
            while (resultSet.next()) {
                //id
                resultSet.getLong(1);
                String name = resultSet.getString(2);
                String email = resultSet.getString(3);
                Date birthday = resultSet.getDate(4);
                Integer age = resultSet.getInt(5);
                String home = resultSet.getString(6);
                byte[] uuid = resultSet.getBytes(7);
                Person p = new Person();
                p.setName(name);
                p.setEmail(email);
                p.setUUID(uuid == null ? null : UUID.nameUUIDFromBytes(uuid));
                p.setBirthday(birthday);
                p.setHomepage(home == null ? null : new URL(home));
                p.setAge(age);
            }
        }
    } catch (MalformedURLException e) {
        throw new RuntimeException();
    }
}
Also used : MalformedURLException(java.net.MalformedURLException) Connection(java.sql.Connection) ResultSet(java.sql.ResultSet) PreparedStatement(java.sql.PreparedStatement) Person(io.requery.test.model.Person) Date(java.sql.Date) URL(java.net.URL) BenchmarkMode(org.openjdk.jmh.annotations.BenchmarkMode) Benchmark(org.openjdk.jmh.annotations.Benchmark)

Example 94 with BenchmarkMode

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

the class ReadOnlyHttp2HeadersBenchmark method defaultClientHeaders.

@Benchmark
@BenchmarkMode(Mode.AverageTime)
public int defaultClientHeaders() {
    Http2Headers headers = new DefaultHttp2Headers(false);
    for (int i = 0; i < headerCount; ++i) {
        headers.add(headerNames[i], headerValues[i]);
    }
    headers.method(HttpMethod.POST.asciiName());
    headers.scheme(HttpScheme.HTTPS.name());
    headers.path(path);
    headers.authority(authority);
    return iterate(headers);
}
Also used : ReadOnlyHttp2Headers(io.netty.handler.codec.http2.ReadOnlyHttp2Headers) Http2Headers(io.netty.handler.codec.http2.Http2Headers) DefaultHttp2Headers(io.netty.handler.codec.http2.DefaultHttp2Headers) DefaultHttp2Headers(io.netty.handler.codec.http2.DefaultHttp2Headers) BenchmarkMode(org.openjdk.jmh.annotations.BenchmarkMode) Benchmark(org.openjdk.jmh.annotations.Benchmark)

Example 95 with BenchmarkMode

use of org.openjdk.jmh.annotations.BenchmarkMode in project logging-log4j2 by apache.

the class ParameterizedMessageBenchmark method refactoredFormatTo.

@Benchmark
@BenchmarkMode(Mode.SampleTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public int refactoredFormatTo(final ThreadState state) {
    state.buffer.setLength(0);
    new ParameterizedMessage("pattern {} with {} two parameters and some text", ARGS).formatTo(state.buffer);
    return state.buffer.length();
}
Also used : ParameterizedMessage(org.apache.logging.log4j.message.ParameterizedMessage) BenchmarkMode(org.openjdk.jmh.annotations.BenchmarkMode) Benchmark(org.openjdk.jmh.annotations.Benchmark) OutputTimeUnit(org.openjdk.jmh.annotations.OutputTimeUnit)

Aggregations

BenchmarkMode (org.openjdk.jmh.annotations.BenchmarkMode)97 Benchmark (org.openjdk.jmh.annotations.Benchmark)96 OutputTimeUnit (org.openjdk.jmh.annotations.OutputTimeUnit)94 QueryableIndexSegment (io.druid.segment.QueryableIndexSegment)37 Result (io.druid.query.Result)27 InputRow (io.druid.data.input.InputRow)26 Row (io.druid.data.input.Row)21 TopNResultValue (io.druid.query.topn.TopNResultValue)15 Cursor (io.druid.segment.Cursor)15 ArrayList (java.util.ArrayList)15 QueryableIndexStorageAdapter (io.druid.segment.QueryableIndexStorageAdapter)13 StorageAdapter (io.druid.segment.StorageAdapter)13 List (java.util.List)13 ImmutableBitmap (io.druid.collections.bitmap.ImmutableBitmap)12 BoundDimFilter (io.druid.query.filter.BoundDimFilter)10 DimFilter (io.druid.query.filter.DimFilter)10 OrDimFilter (io.druid.query.filter.OrDimFilter)9 SelectorDimFilter (io.druid.query.filter.SelectorDimFilter)9 AndDimFilter (io.druid.query.filter.AndDimFilter)8 FinalizeResultsQueryRunner (io.druid.query.FinalizeResultsQueryRunner)7