本文整理汇总了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);
}
示例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));
}
}
示例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);
}
示例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());
}
示例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);
}
}
示例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));
}
}
示例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);
}
}
示例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));
}
}
示例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());
}
}
示例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);
}
}
示例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));
}
示例12: uncachedNtpClockMillis
import org.openjdk.jmh.infra.Blackhole; //导入方法依赖的package包/类
@Benchmark
public void uncachedNtpClockMillis(Blackhole bh) {
long now = clockWithoutCaching.millis();
bh.consume(now);
}
示例13: fastBuffered
import org.openjdk.jmh.infra.Blackhole; //导入方法依赖的package包/类
@Benchmark
public void fastBuffered(Blackhole bh) {
fastBuffered(a, b, c, size);
bh.consume(c);
}
示例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++);
}
示例15: nonProxy
import org.openjdk.jmh.infra.Blackhole; //导入方法依赖的package包/类
@Benchmark
public void nonProxy(ProxyHolder holder, Blackhole bh) {
bh.consume(holder.uppercaser.toUpperCase(INPUT));
}