Java 类org.openjdk.jmh.annotations.OperationsPerInvocation 实例源码

项目:direwolves    文件:ValidationBenchmarks.java   
@Benchmark
@BenchmarkMode(Mode.Throughput)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
@Fork(1)
@OperationsPerInvocation(10000)
public void testApi() {
  Map<String, Object> data = new HashMap<String, Object>();
  data.put("encryptKey", "0000000000000000");
  data.put("barcode", "LH10312ACCF23C4F3A5");

  Multimap<String, Rule> rules = ArrayListMultimap.create();

  rules.put("barcode", Rule.required());
  rules.put("barcode", Rule.regex("[0-9A-F]{16}"));
  rules.put("encryptKey", Rule.required());
  rules.put("encryptKey", Rule.regex("LH[0-7][0-9a-fA-F]{2}[0-5][0-4][0-9a-fA-F]{12}"));
  try {
    Validations.validate(data, rules);
  } catch (Exception e) {
  }

}
项目:direwolves    文件:ValidationBenchmarks.java   
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
@Fork(1)
@OperationsPerInvocation(10000)
public void testAverage() {
  Map<String, Object> data = new HashMap<String, Object>();
  data.put("encryptKey", "0000000000000000");
  data.put("barcode", "LH10312ACCF23C4F3A5");

  Multimap<String, Rule> rules = ArrayListMultimap.create();

  rules.put("barcode", Rule.required());
  rules.put("barcode", Rule.regex("[0-9A-F]{16}"));
  rules.put("encryptKey", Rule.required());
  rules.put("encryptKey", Rule.regex("LH[0-7][0-9a-fA-F]{2}[0-5][0-4][0-9a-fA-F]{12}"));
  try {
    Validations.validate(data, rules);
  } catch (Exception e) {
  }
}
项目:presto    文件:BenchmarkGroupByHash.java   
@Benchmark
@OperationsPerInvocation(POSITIONS)
public Object groupByHashPreCompute(BenchmarkData data)
{
    GroupByHash groupByHash = new MultiChannelGroupByHash(data.getTypes(), data.getChannels(), Optional.empty(), data.getHashChannel(), EXPECTED_SIZE, false);
    data.getPages().forEach(groupByHash::getGroupIds);

    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();
}
项目:presto    文件:BenchmarkGroupByHash.java   
@Benchmark
@OperationsPerInvocation(POSITIONS)
public Object addPagePreCompute(BenchmarkData data)
{
    GroupByHash groupByHash = new MultiChannelGroupByHash(data.getTypes(), data.getChannels(), Optional.empty(), data.getHashChannel(), EXPECTED_SIZE, false);
    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();
}
项目:presto    文件:BenchmarkGroupByHash.java   
@Benchmark
@OperationsPerInvocation(POSITIONS)
public Object bigintGroupByHash(SingleChannelBenchmarkData data)
{
    GroupByHash groupByHash = new BigintGroupByHash(0, Optional.empty(), 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();
}
项目:faster    文件:FasterByteComparisonBenchmark.java   
@Benchmark
@OperationsPerInvocation(COMPARISONS_PER_INVOCATION)
public final void compareOneByte(final Blackhole blackhole) {
    int res = 0;
    for (int i = 0; i < COMPARISONS_PER_INVOCATION; ++i) {
        res += FasterByteComparison.compare(ONE_BYTE, MANY_BYTES);
    }
    blackhole.consume(res);
}
项目:faster    文件:FasterByteComparisonBenchmark.java   
@Benchmark
@OperationsPerInvocation(COMPARISONS_PER_INVOCATION)
public final void compareTwoBytes(final Blackhole blackhole) {
    int res = 0;
    for (int i = 0; i < COMPARISONS_PER_INVOCATION; ++i) {
        res += FasterByteComparison.compare(TWO_BYTES, MANY_BYTES);
    }
    blackhole.consume(res);
}
项目:faster    文件:FasterByteComparisonBenchmark.java   
@Benchmark
@OperationsPerInvocation(COMPARISONS_PER_INVOCATION)
public final void compareThreeBytes(final Blackhole blackhole) {
    int res = 0;
    for (int i = 0; i < COMPARISONS_PER_INVOCATION; ++i) {
        res += FasterByteComparison.compare(THREE_BYTES, MANY_BYTES);
    }
    blackhole.consume(res);
}
项目:faster    文件:FasterByteComparisonBenchmark.java   
@Benchmark
@OperationsPerInvocation(COMPARISONS_PER_INVOCATION)
public final void compareFourBytes(final Blackhole blackhole) {
    int res = 0;
    for (int i = 0; i < COMPARISONS_PER_INVOCATION; ++i) {
        res += FasterByteComparison.compare(FOUR_BYTES, MANY_BYTES);
    }
    blackhole.consume(res);
}
项目:faster    文件:FasterByteComparisonBenchmark.java   
@Benchmark
@OperationsPerInvocation(COMPARISONS_PER_INVOCATION)
public final void compareFiveBytes(final Blackhole blackhole) {
    int res = 0;
    for (int i = 0; i < COMPARISONS_PER_INVOCATION; ++i) {
        res += FasterByteComparison.compare(FIVE_BYTES, MANY_BYTES);
    }
    blackhole.consume(res);
}
项目:faster    文件:FasterByteComparisonBenchmark.java   
@Benchmark
@OperationsPerInvocation(COMPARISONS_PER_INVOCATION)
public final void compareSixBytes(final Blackhole blackhole) {
    int res = 0;
    for (int i = 0; i < COMPARISONS_PER_INVOCATION; ++i) {
        res += FasterByteComparison.compare(SIX_BYTES, MANY_BYTES);
    }
    blackhole.consume(res);
}
项目:faster    文件:FasterByteComparisonBenchmark.java   
@Benchmark
@OperationsPerInvocation(COMPARISONS_PER_INVOCATION)
public final void compareSevenBytes(final Blackhole blackhole) {
    int res = 0;
    for (int i = 0; i < COMPARISONS_PER_INVOCATION; ++i) {
        res += FasterByteComparison.compare(SEVEN_BYTES, MANY_BYTES);
    }
    blackhole.consume(res);
}
项目:faster    文件:FasterByteComparisonBenchmark.java   
@Benchmark
@OperationsPerInvocation(COMPARISONS_PER_INVOCATION)
public final void compareEightBytes(final Blackhole blackhole) {
    int res = 0;
    for (int i = 0; i < COMPARISONS_PER_INVOCATION; ++i) {
        res += FasterByteComparison.compare(EIGHT_BYTES, MANY_BYTES);
    }
    blackhole.consume(res);
}
项目:faster    文件:FasterByteComparisonBenchmark.java   
@Benchmark
@OperationsPerInvocation(COMPARISONS_PER_INVOCATION)
public final void compareNineBytes(final Blackhole blackhole) {
    int res = 0;
    for (int i = 0; i < COMPARISONS_PER_INVOCATION; ++i) {
        res += FasterByteComparison.compare(NINE_BYTES, MANY_BYTES);
    }
    blackhole.consume(res);
}
项目:faster    文件:FasterByteComparisonBenchmark.java   
@Benchmark
@OperationsPerInvocation(COMPARISONS_PER_INVOCATION)
public final void compareTenBytes(final Blackhole blackhole) {
    int res = 0;
    for (int i = 0; i < COMPARISONS_PER_INVOCATION; ++i) {
        res += FasterByteComparison.compare(TEN_BYTES, MANY_BYTES);
    }
    blackhole.consume(res);
}
项目:faster    文件:FasterByteComparisonBenchmark.java   
@Benchmark
@OperationsPerInvocation(COMPARISONS_PER_INVOCATION)
public final void compareThirtyTwoBytes(final Blackhole blackhole) {
    int res = 0;
    for (int i = 0; i < COMPARISONS_PER_INVOCATION; ++i) {
        res += FasterByteComparison.compare(THIRTY_TWO_BYTES, MANY_BYTES);
    }
    blackhole.consume(res);
}
项目:kafka-0.11.0.0-src-with-comment    文件:RecordBatchIterationBenchmark.java   
@OperationsPerInvocation(value = batchCount)
@Benchmark
public void measureStreamingIteratorForVariableBatchSize(Blackhole bh) throws IOException {
    for (int i = 0; i < batchCount; ++i) {
        for (RecordBatch batch : MemoryRecords.readableRecords(batchBuffers[i].duplicate()).batches()) {
            try (CloseableIterator<Record> iterator = batch.streamingIterator(bufferSupplier)) {
                while (iterator.hasNext())
                    bh.consume(iterator.next());
            }
        }
    }
}
项目:openjdk-jdk10    文件:ArrayDuplicationBenchmark.java   
@Benchmark
@OperationsPerInvocation(TESTSIZE)
public Object[] normalArraycopy() {
    int j = 0;
    for (int i = 0; i < TESTSIZE; i++) {
        dummy[j++] = normalArraycopy(testObjectArray[i]);
    }
    return dummy;
}
项目:openjdk-jdk10    文件:ArrayDuplicationBenchmark.java   
@Benchmark
@OperationsPerInvocation(TESTSIZE)
public Object[] arraysCopyOf() {
    int j = 0;
    for (int i = 0; i < TESTSIZE; i++) {
        dummy[j++] = arraysCopyOf(testObjectArray[i]);
    }
    return dummy;
}
项目:openjdk-jdk10    文件:ArrayDuplicationBenchmark.java   
@Benchmark
@OperationsPerInvocation(TESTSIZE)
public Object[] cloneObjectArray() {
    int j = 0;
    for (int i = 0; i < TESTSIZE; i++) {
        dummy[j++] = arraysClone(testObjectArray[i]);
    }
    return dummy;
}
项目:graal-core    文件:ArrayDuplicationBenchmark.java   
@Benchmark
@OperationsPerInvocation(TESTSIZE)
public Object[] normalArraycopy() {
    int j = 0;
    for (int i = 0; i < TESTSIZE; i++) {
        dummy[j++] = normalArraycopy(testObjectArray[i]);
    }
    return dummy;
}
项目:graal-core    文件:ArrayDuplicationBenchmark.java   
@Benchmark
@OperationsPerInvocation(TESTSIZE)
public Object[] arraysCopyOf() {
    int j = 0;
    for (int i = 0; i < TESTSIZE; i++) {
        dummy[j++] = arraysCopyOf(testObjectArray[i]);
    }
    return dummy;
}
项目:graal-core    文件:ArrayDuplicationBenchmark.java   
@Benchmark
@OperationsPerInvocation(TESTSIZE)
public Object[] cloneObjectArray() {
    int j = 0;
    for (int i = 0; i < TESTSIZE; i++) {
        dummy[j++] = arraysClone(testObjectArray[i]);
    }
    return dummy;
}
项目:jvm-primitive-ops-benchmarks    文件:BenchmarkDoubleDiv.java   
@Benchmark
@OperationsPerInvocation(10)
public double testDivWith10SummedFields() {
    double result = 0;
    for (int i = 0; i < 10; ++i) {
        result += c / d;
    }
    return result;
}
项目:jvm-primitive-ops-benchmarks    文件:BenchmarkDoubleDiv.java   
@Benchmark
@OperationsPerInvocation(100)
public double testDivWith100SummedFields() {
    double result = 0;
    for (int i = 0; i < 100; ++i) {
        result += c / d;
    }
    return result;
}
项目:jvm-primitive-ops-benchmarks    文件:BenchmarkDoubleDiv.java   
@Benchmark
@OperationsPerInvocation(10)
public long testDivWith10XoredFields() {
    long result = 0;
    for (int i = 0; i < 10; ++i) {
        result ^= Double.doubleToRawLongBits(c / d);
    }
    return result;
}
项目:jvm-primitive-ops-benchmarks    文件:BenchmarkDoubleDiv.java   
@Benchmark
@OperationsPerInvocation(100)
public double testDivWith100XoredFields() {
    long result = 0;
    for (int i = 0; i < 100; ++i) {
        result ^= Double.doubleToRawLongBits(c / d);
    }
    return result;
}
项目:jvm-primitive-ops-benchmarks    文件:BenchmarkDoubleDiv.java   
@Benchmark
@OperationsPerInvocation(10)
public double[] testDivWith10Fields() {
    double[] result = new double[10];
    for (int i = 0; i < 10; ++i) {
        result[i] = as[i] / bs[i];
    }
    return result;
}
项目:jvm-primitive-ops-benchmarks    文件:BenchmarkDoubleDiv.java   
@Benchmark
@OperationsPerInvocation(10)
public double[] testDivWith10FieldsNoAllocation() {
    for (int i = 0; i < 10; ++i) {
        cs[i] = as[i] / bs[i];
    }
    return cs;
}
项目:lin-check    文件:SingleThreadedOffer.java   
@GenerateMicroBenchmark
@OperationsPerInvocation(CAPACITY)
public void offer()
{
    final Queue<Integer> lq = q;
    for (int i = 0; i < CAPACITY; i++)
    {
        lq.offer(TOKEN);
    }
}
项目:lin-check    文件:SingleThreadedPoll.java   
@GenerateMicroBenchmark
@OperationsPerInvocation(CAPACITY)
public void poll()
{
    final Queue<Integer> lq = q;
    for (int i = 0; i < CAPACITY; i++)
    {
        lq.poll();
    }
}
项目:oopsla15-artifact    文件:JmhSetBenchmarks.java   
@Benchmark
@OperationsPerInvocation(CACHED_NUMBERS_SIZE)
public void timeContainsKey(Blackhole bh) {
    for (int i = 0; i < CACHED_NUMBERS_SIZE; i++) {
        bh.consume(testSet.contains(cachedNumbers[i]));
    }
}
项目:oopsla15-artifact    文件:JmhSetBenchmarks.java   
@Benchmark
@OperationsPerInvocation(CACHED_NUMBERS_SIZE)
public void timeContainsKeyNotContained(Blackhole bh) {
    for (int i = 0; i < CACHED_NUMBERS_SIZE; i++) {
        bh.consume(testSet.contains(cachedNumbersNotContained[i]));
    }
}
项目:oopsla15-artifact    文件:JmhSetBenchmarks.java   
@Benchmark
@OperationsPerInvocation(CACHED_NUMBERS_SIZE)
public void timeInsert(Blackhole bh) {
    for (int i = 0; i < CACHED_NUMBERS_SIZE; i++) {
        bh.consume(testSet.insert(cachedNumbersNotContained[i]));

    }
}
项目:oopsla15-artifact    文件:JmhSetBenchmarks.java   
@Benchmark
@OperationsPerInvocation(CACHED_NUMBERS_SIZE)
public void timeInsertContained(Blackhole bh) {
    for (int i = 0; i < CACHED_NUMBERS_SIZE; i++) {
        bh.consume(testSet.insert(cachedNumbers[i]));

    }
}
项目:oopsla15-artifact    文件:JmhSetBenchmarks.java   
@Benchmark
@OperationsPerInvocation(CACHED_NUMBERS_SIZE)
public void timeRemoveKey(Blackhole bh) {
    for (int i = 0; i < CACHED_NUMBERS_SIZE; i++) {
        bh.consume(testSet.delete(cachedNumbers[i]));
    }
}
项目:oopsla15-artifact    文件:JmhSetBenchmarks.java   
@Benchmark
@OperationsPerInvocation(CACHED_NUMBERS_SIZE)
public void timeRemoveKeyNotContained(Blackhole bh) {
    for (int i = 0; i < CACHED_NUMBERS_SIZE; i++) {
        bh.consume(testSet.delete(cachedNumbersNotContained[i]));
    }
}
项目:oopsla15-artifact    文件:JmhMapBenchmarks.java   
@Benchmark
@OperationsPerInvocation(CACHED_NUMBERS_SIZE)
public void timeContainsKey(Blackhole bh) {
    for (int i = 0; i < CACHED_NUMBERS_SIZE; i++) {
        bh.consume(testMap.containsKey(cachedNumbers[i]));
    }
}
项目:oopsla15-artifact    文件:JmhMapBenchmarks.java   
@Benchmark
@OperationsPerInvocation(CACHED_NUMBERS_SIZE)
public void timeContainsKeyNotContained(Blackhole bh) {
    for (int i = 0; i < CACHED_NUMBERS_SIZE; i++) {
        bh.consume(testMap.containsKey(cachedNumbersNotContained[i]));
    }
}
项目:oopsla15-artifact    文件:JmhMapBenchmarks.java   
@Benchmark
@OperationsPerInvocation(CACHED_NUMBERS_SIZE)
public void timeInsert(Blackhole bh) {
    for (int i = 0; i < CACHED_NUMBERS_SIZE; i++) {
        bh.consume(testMap.put(cachedNumbersNotContained[i], VALUE_NOT_EXISTING));
    }
}