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


Java Blackhole类代码示例

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


Blackhole类属于org.openjdk.jmh.infra包,在下文中一共展示了Blackhole类的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: 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

示例3: pooledConnectionPreparedStatementQuery

import org.openjdk.jmh.infra.Blackhole; //导入依赖的package包/类
@Benchmark
public void pooledConnectionPreparedStatementQuery(Blackhole blackhole) throws Exception {
  CompletableFuture<PgResult> latch = new CompletableFuture<>();
  pool.getConnection(ar1 -> {
    if (ar1.succeeded()) {
      PgConnection conn = ar1.result();
      conn.prepare("SELECT id, randomnumber from WORLD", ar2 -> {
        if (ar2.succeeded()) {
          PgPreparedQuery ps = ar2.result();
          ps.execute(ar3 -> {
            conn.close();
            if (ar3.succeeded()) {
              latch.complete(ar3.result());
            } else {
              latch.completeExceptionally(ar3.cause());
            }
          });
        } else {
          latch.completeExceptionally(ar2.cause());
        }
      });
    } else {
      latch.completeExceptionally(ar1.cause());
    }
  });
  blackhole.consume(latch.get());
}
 
开发者ID:vietj,项目名称:reactive-pg-client,代码行数:28,代码来源:LargeSelectBenchmark.java

示例4: Add_Ints

import org.openjdk.jmh.infra.Blackhole; //导入依赖的package包/类
@Benchmark
@CompilerControl(CompilerControl.Mode.DONT_INLINE)
public void Add_Ints(IntData d, Blackhole bh) {
    int[] data1 = d.data1;
    int[] data2 = d.data2;
    int[] result = new int[data1.length];
    for (int i = 0; i < data1.length; ++i) {
        result[i] = data1[i] + data2[i];
    }
    bh.consume(result);
}
 
开发者ID:richardstartin,项目名称:simdbenchmarks,代码行数:12,代码来源:Addition.java

示例5: pointSmallTimes1000LowAllocation

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

示例7: 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();
        testObject.writeTo(byteArrayOutputStream);
        bh.consume(byteArrayOutputStream);
    }
}
 
开发者ID:json-iterator,项目名称:java-benchmark,代码行数:11,代码来源:SerPb.java

示例8: 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

示例9: deser

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

示例10: deser

import org.openjdk.jmh.infra.Blackhole; //导入依赖的package包/类
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public void deser(Blackhole bh) throws TException {
    for (int i = 0; i < 1000; i++) {
        ThriftTestObject obj = new ThriftTestObject();
        deserializer.deserialize(testObject, testData);
        bh.consume(obj);
    }
}
 
开发者ID:json-iterator,项目名称:java-benchmark,代码行数:11,代码来源:DeserThrift.java

示例11: createAndDeleteAdd

import org.openjdk.jmh.infra.Blackhole; //导入依赖的package包/类
@Benchmark
public void createAndDeleteAdd(StringEquals s, Blackhole bh) {
    AddNode addNode = new AddNode(ConstantNode.forInt(40), ConstantNode.forInt(2));
    s.graph.addOrUniqueWithInputs(addNode);
    GraphUtil.killWithUnusedFloatingInputs(addNode);
    bh.consume(addNode);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:NodeBenchmark.java

示例12: colFirst

import org.openjdk.jmh.infra.Blackhole; //导入依赖的package包/类
@Benchmark
@OperationsPerInvocation(MATRIX_SIZE)
public void colFirst(Blackhole bh) {
    for (int c = 0; c < COUNT; c++) {
        for (int r = 0; r < COUNT; r++) {
            bh.consume(matrix[r][c]);
        }
    }
}
 
开发者ID:mumudemo,项目名称:mumu-benchmark,代码行数:10,代码来源:JMHSample_37_CacheAccess.java

示例13: rowFirst

import org.openjdk.jmh.infra.Blackhole; //导入依赖的package包/类
@Benchmark
@OperationsPerInvocation(MATRIX_SIZE)
public void rowFirst(Blackhole bh) {
    for (int r = 0; r < COUNT; r++) {
        for (int c = 0; c < COUNT; c++) {
            bh.consume(matrix[r][c]);
        }
    }
}
 
开发者ID:mumudemo,项目名称:mumu-benchmark,代码行数:10,代码来源:JMHSample_37_CacheAccess.java

示例14: 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++) {
        jsonWriter.reset();
        byteArrayOutputStream.reset();
        ExternalSerialization.serialize(testObject, jsonWriter, false);
        jsonWriter.toStream(byteArrayOutputStream);
        bh.consume(byteArrayOutputStream);
    }
}
 
开发者ID:json-iterator,项目名称:java-benchmark,代码行数:13,代码来源:SerDslJson.java

示例15: 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();
        objectMapper.writeValue(byteArrayOutputStream, testObject);
        bh.consume(byteArrayOutputStream);
    }
}
 
开发者ID:json-iterator,项目名称:java-benchmark,代码行数:11,代码来源:SerJackson.java


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