当前位置: 首页>>代码示例>>Java>>正文


Java Blackhole.consume方法代码示例

本文整理汇总了Java中org.openjdk.jmh.infra.Blackhole.consume方法的典型用法代码示例。如果您正苦于以下问题:Java Blackhole.consume方法的具体用法?Java Blackhole.consume怎么用?Java Blackhole.consume使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.openjdk.jmh.infra.Blackhole的用法示例。


在下文中一共展示了Blackhole.consume方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: linkedHashMap

import org.openjdk.jmh.infra.Blackhole; //导入方法依赖的package包/类
@Benchmark
public void linkedHashMap(Blackhole bh) {

    Map<Integer, String> map = new LinkedHashMap<>();

    map.put(0, "zero");
    map.put(1, "one");
    map.put(2, "two");
    map.put(3, "three");
    map.put(4, "four");
    map.put(5, "five");
    map.put(6, "six");
    map.put(7, "seven");
    map.put(8, "eight");
    map.put(9, "nine");

    bh.consume(map);
    
}
 
开发者ID:Abrasha,项目名称:benchmark-it,代码行数:20,代码来源:HashMapVSLinkedHashMap.java

示例2: roundTripSmallTimes1000LowAllocation

import org.openjdk.jmh.infra.Blackhole; //导入方法依赖的package包/类
@Benchmark
public void roundTripSmallTimes1000LowAllocation(Blackhole b) {
    for (long i = 0; i < N; i++) {
        small.point(i, point);
        b.consume(i == small.index(point));
    }
}
 
开发者ID:davidmoten,项目名称:hilbert-curve,代码行数:8,代码来源:Benchmarks.java

示例3: daxpy

import org.openjdk.jmh.infra.Blackhole; //导入方法依赖的package包/类
@Benchmark
public void daxpy(Blackhole bh) {
  for (int i = 0; i < a.length; ++i) {
    a[i] += s * b[i];
  }
  bh.consume(a);
}
 
开发者ID:richardstartin,项目名称:simdbenchmarks,代码行数:8,代码来源:DAXPYAlignment.java

示例4: poolPreparedBatchUpdate

import org.openjdk.jmh.infra.Blackhole; //导入方法依赖的package包/类
@Benchmark
public void poolPreparedBatchUpdate(Blackhole blackhole) throws Exception {
  CompletableFuture<PgResult<Row>> latch = new CompletableFuture<>();
  pool.preparedBatch("UPDATE world SET randomnumber=$1 WHERE id=$2", batch, ar -> {
    if (ar.succeeded()) {
      latch.complete(ar.result());
    } else {
      latch.completeExceptionally(ar.cause());
    }
  });
  blackhole.consume(latch.get());
}
 
开发者ID:vietj,项目名称:reactive-pg-client,代码行数:13,代码来源:UpdateBenchmark.java

示例5: deser

import org.openjdk.jmh.infra.Blackhole; //导入方法依赖的package包/类
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public void deser(Blackhole bh) throws IOException {
    for (int i = 0; i < 1000; i++) {
        reader.reset();
        reader.read();
        reader.getNextToken();
        TestObject obj = new TestObject();
        ExternalSerialization.deserialize(obj, reader);
        bh.consume(obj);
    }
}
 
开发者ID:json-iterator,项目名称:java-benchmark,代码行数:14,代码来源:DeserDslJson.java

示例6: deser

import org.openjdk.jmh.infra.Blackhole; //导入方法依赖的package包/类
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public void deser(Blackhole bh) throws IOException {
    for (int i = 0; i < 1000; i++) {
        bh.consume(objectMapper.readValue(testJSON, typeReference));
    }
}
 
开发者ID:json-iterator,项目名称:java-benchmark,代码行数:9,代码来源:DeserJackson.java

示例7: baseline

import org.openjdk.jmh.infra.Blackhole; //导入方法依赖的package包/类
@Benchmark
public void baseline(Blackhole bh) {
    for (double[] test : data) {
        System.arraycopy(test, 0, temp, 0, test.length);
        bh.consume(temp);
    }
}
 
开发者ID:mbuzdalov,项目名称:non-dominated-sorting,代码行数:8,代码来源:MedianBenchmark.java

示例8: deser

import org.openjdk.jmh.infra.Blackhole; //导入方法依赖的package包/类
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public void deser(Blackhole bh) throws IOException {
    for (int i = 0; i < 1000; i++) {
        bh.consume(Pb.PbTestObject.parseFrom(testData));
    }
}
 
开发者ID:json-iterator,项目名称:java-benchmark,代码行数:9,代码来源:DeserPb.java

示例9: withIterator

import org.openjdk.jmh.infra.Blackhole; //导入方法依赖的package包/类
@Benchmark
public void withIterator(StringsToIterate strings, Blackhole bh) {
    Iterator<String> it = strings.strings.iterator();
    while (it.hasNext()){
        bh.consume(it.next());
    }
}
 
开发者ID:Abrasha,项目名称:benchmark-it,代码行数:8,代码来源:CollectionIteration.java

示例10: ser

import org.openjdk.jmh.infra.Blackhole; //导入方法依赖的package包/类
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public void ser(Blackhole bh) throws IOException {
    for (int i = 0; i < 1000; i++) {
        byteArrayOutputStream.reset();
        stream.reset(byteArrayOutputStream);
        stream.writeVal(testObject);
        stream.flush();
        bh.consume(byteArrayOutputStream);
    }
}
 
开发者ID:json-iterator,项目名称:java-benchmark,代码行数:13,代码来源:SerJsoniter.java

示例11: ks3

import org.openjdk.jmh.infra.Blackhole; //导入方法依赖的package包/类
public void ks3(Blackhole bh) throws Exception {
	JsonParserKS3 parser = new JsonParserKS3();
	bh.consume(parser.json(input, NULL));
}
 
开发者ID:httpdigest,项目名称:ftljson,代码行数:5,代码来源:B.java

示例12: uncachedNtpClockMillis

import org.openjdk.jmh.infra.Blackhole; //导入方法依赖的package包/类
@Benchmark
public void uncachedNtpClockMillis(Blackhole bh) {
  long now = clockWithoutCaching.millis();
  bh.consume(now);
}
 
开发者ID:jbrisbin,项目名称:reactor-ntp-clock,代码行数:6,代码来源:TimeMeasurementBenchmarks.java

示例13: fastBuffered

import org.openjdk.jmh.infra.Blackhole; //导入方法依赖的package包/类
@Benchmark
public void fastBuffered(Blackhole bh) {
  fastBuffered(a, b, c, size);
  bh.consume(c);
}
 
开发者ID:richardstartin,项目名称:simdbenchmarks,代码行数:6,代码来源:MMM.java

示例14: log4j___Log_javautilStyle

import org.openjdk.jmh.infra.Blackhole; //导入方法依赖的package包/类
@Benchmark
public void log4j___Log_javautilStyle(Blackhole x) {
    LOGGER.info("Simple {} Param String", i);
    x.consume(i++);
}
 
开发者ID:stephenc,项目名称:java-logging-benchmarks,代码行数:6,代码来源:LoggingBenchmark.java

示例15: nonProxy

import org.openjdk.jmh.infra.Blackhole; //导入方法依赖的package包/类
@Benchmark
public void nonProxy(ProxyHolder holder, Blackhole bh) {
    bh.consume(holder.uppercaser.toUpperCase(INPUT));
}
 
开发者ID:Abrasha,项目名称:benchmark-it,代码行数:5,代码来源:ProxyVsNonProxy.java


注:本文中的org.openjdk.jmh.infra.Blackhole.consume方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。