本文整理匯總了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));
}