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


Java BenchmarkOptions类代码示例

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


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

示例1: readAllVerticesAndProperties

import com.carrotsearch.junitbenchmarks.BenchmarkOptions; //导入依赖的package包/类
@Test
@BenchmarkOptions(benchmarkRounds = 10, warmupRounds = 0, concurrency = BenchmarkOptions.CONCURRENCY_SEQUENTIAL)
public void readAllVerticesAndProperties() throws Exception {
    final AtomicInteger counter = new AtomicInteger(0);

    // read the vertices 10 times over
    for (int ix = 0; ix < 10; ix++) {
        graph.vertices().forEachRemaining(vertex -> {
            assertNotNull(vertex.value("name"));
            counter.incrementAndGet();
        });

        assertEquals(10000, counter.get());
        counter.set(0);
    }
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:17,代码来源:GraphReadPerformanceTest.java

示例2: readAllEdgesAndProperties

import com.carrotsearch.junitbenchmarks.BenchmarkOptions; //导入依赖的package包/类
@Test
@BenchmarkOptions(benchmarkRounds = 10, warmupRounds = 0, concurrency = BenchmarkOptions.CONCURRENCY_SEQUENTIAL)
public void readAllEdgesAndProperties() throws Exception {
    final AtomicInteger counter = new AtomicInteger(0);

    // read the vertices 10 times over
    for (int ix = 0; ix < 10; ix++) {
        graph.edges().forEachRemaining(edge -> {
            assertNotNull(edge.value("weight"));
            counter.incrementAndGet();
        });

        assertEquals(edgeCount, counter.get());
        counter.set(0);
    }
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:17,代码来源:GraphReadPerformanceTest.java

示例3: writeEmptyVerticesAndEdges

import com.carrotsearch.junitbenchmarks.BenchmarkOptions; //导入依赖的package包/类
@Test
@BenchmarkOptions(benchmarkRounds = 10, warmupRounds = 0, concurrency = BenchmarkOptions.CONCURRENCY_SEQUENTIAL)
public void writeEmptyVerticesAndEdges() throws Exception {
    final int verticesToGenerate = 100000;
    Optional<Vertex> lastVertex = Optional.empty();
    for (int ix = 0; ix < verticesToGenerate; ix++) {
        final Vertex v = graph.addVertex();
        if (lastVertex.isPresent())
            v.addEdge("parent", lastVertex.get());

        lastVertex = Optional.of(v);
        tryBatchCommit(graph, ix);
    }

    assertVertexEdgeCounts(graph, verticesToGenerate, verticesToGenerate - 1);
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:17,代码来源:GraphWritePerformanceTest.java

示例4: encodeHexString

import com.carrotsearch.junitbenchmarks.BenchmarkOptions; //导入依赖的package包/类
@Test
@BenchmarkOptions(benchmarkRounds = 3, warmupRounds = 2, concurrency = 1)
// round: 0.15
public void encodeHexString() {
	String value = "中文測試abcdef";// 616263646566
	String result = null;
	//
	int count = 10000;

	long beg = System.currentTimeMillis();
	for (int i = 0; i < count; i++) {
		result = EncodingHelper.encodeHex(value);
	}
	long end = System.currentTimeMillis();
	System.out.println(count + " times: " + (end - beg) + " mills. ");

	System.out.println(result.length() + ", " + result);// 36,
														// e4b8ade69687e6b8ace8a9a6616263646566
	assertEquals("e4b8ade69687e6b8ace8a9a6616263646566", result);
	//
	result = EncodingHelper.encodeHex("abc");
	System.out.println(result.length() + ", " + result);// 6, 616263
	//
	result = EncodingHelper.encodeHex("123");
	System.out.println(result.length() + ", " + result);// 6, 313233
}
 
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:27,代码来源:EncodingHelperTest.java

示例5: adler32

import com.carrotsearch.junitbenchmarks.BenchmarkOptions; //导入依赖的package包/类
@Test
@BenchmarkOptions(benchmarkRounds = 100, warmupRounds = 1, concurrency = 100)
// round: 4.57 [+- 0.46], round.block: 0.26 [+- 0.03], round.gc: 0.00 [+-
// 0.00], GC.calls: 5, GC.time: 0.02, time.total: 4.64, time.warmup: 0.01,
// time.bench: 4.62
public void adler32() {
	byte[] value = new byte[307200];// 300k
	long result = 0;
	//
	result = ChecksumHelper.adler32(value);
	//
	System.out.println(result);
	assertEquals(2956722177L, result);
	//
	InputStream in = new ByteArrayInputStream(value);
	result = ChecksumHelper.adler32(in);
	System.out.println(result);
	assertEquals(2956722177L, result);
}
 
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:20,代码来源:ChecksumHelperTest.java

示例6: dekryoReadClass

import com.carrotsearch.junitbenchmarks.BenchmarkOptions; //导入依赖的package包/类
@BenchmarkOptions(benchmarkRounds = 10, warmupRounds = 1, concurrency = 10)
@Test
// round: 1.02 [+- 0.10], round.block: 0.11 [+- 0.03], round.gc: 0.00 [+-
// 0.00], GC.calls: 7, GC.time: 0.05, time.total: 1.07, time.warmup: 0.00,
// time.bench: 1.07

// 2017/11/28
// round: 4.49 [+- 1.44], round.block: 0.15 [+- 0.19], round.gc: 0.00 [+- 0.00],
// GC.calls: 4, GC.time: 0.10, time.total: 5.11, time.warmup: 0.00, time.bench:
// 5.11
public void dekryoReadClass() {
	List<Object> list = mockLinkedList();
	byte[] value = SerializeHelper.kryoWriteClass(new Kryo(), list);

	List<Object> result = null;
	//
	result = SerializeHelper.dekryoReadClass(new Kryo(), value);
	//
	System.out.println(result.size());
	assertCollectionEquals(list, result);
}
 
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:22,代码来源:SerializeHelperTest.java

示例7: getDeclaredMethod

import com.carrotsearch.junitbenchmarks.BenchmarkOptions; //导入依赖的package包/类
@Test
@BenchmarkOptions(benchmarkRounds = 3, warmupRounds = 2, concurrency = 1)
// round: 0.01
public void getDeclaredMethod() throws Exception {
	BaseTestSupporter object = new BaseTestSupporter();
	Method method = BaseTestSupporter.getDeclaredMethod(
			BaseTestSupporter.class, "printBeans");
	Object result = null;
	//
	final int COUNT = 10000;
	for (int i = 0; i < COUNT; i++) {
		result = method.invoke(object);
	}
	//
	System.out.println(result);
	//
	method = BaseTestSupporter.getDeclaredMethod(null, "printBeans");
	assertNull(method);
	//
	method = BaseTestSupporter.getDeclaredMethod(BaseTestSupporter.class,
			"xxx");
	assertNull(method);
}
 
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:24,代码来源:BaseTestSupporterTest.java

示例8: invoke

import com.carrotsearch.junitbenchmarks.BenchmarkOptions; //导入依赖的package包/类
@Override
public Object invoke(Object proxy, Method method, Object[] args)
        throws IllegalAccessException, IllegalArgumentException,
        InvocationTargetException {
    if (method.getName().equals("benchmarkRounds")) {
        log.trace("Intercepted benchmarkRounds() invocation: returning {}", rounds);
        return rounds;
    }
    if (method.getName().equals("warmupRounds")) {
        log.trace("Intercepted warmupRounds() invocation: returning {}", WARMUP_ROUNDS);
        return WARMUP_ROUNDS;
    }
    if (method.getName().equals("annotationType")) {
        return BenchmarkOptions.class;
    }
    log.trace("Returning default value for method intercepted invocation of method {}", method.getName());
    return method.getDefaultValue();
}
 
开发者ID:graben1437,项目名称:titan1.0.1.kafka,代码行数:19,代码来源:JUnitBenchmarkProvider.java

示例9: genericClone

import com.carrotsearch.junitbenchmarks.BenchmarkOptions; //导入依赖的package包/类
@Test
// no cache
// 1000000 times: 515 mills.
// 1000000 times: 537 mills.
// 1000000 times: 509 mills.
//
// cache
// 1000000 times: 533 mills.
// 1000000 times: 531 mills.
// 1000000 times: 530 mills.
@BenchmarkOptions(benchmarkRounds = 100, warmupRounds = 1, concurrency = 100)
// round: 0.42 [+- 0.04], round.block: 0.02 [+- 0.01], round.gc: 0.00 [+-
// 0.00], GC.calls: 4, GC.time: 0.01, time.total: 0.43, time.warmup: 0.00,
// time.bench: 0.43
public void genericClone() {
	Date value = new Date();
	System.out.println("value: " + value);
	//
	Date cloneValue = null;

	cloneValue = CloneHelper.genericClone(value);
	//
	cloneValue.setYear(50);// 1950
	System.out.println("modified cloneValue: " + cloneValue);
	System.out.println("after value: " + value);
}
 
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:27,代码来源:CloneHelperTest.java

示例10: isJavaVersionAtLeast

import com.carrotsearch.junitbenchmarks.BenchmarkOptions; //导入依赖的package包/类
@Test
@BenchmarkOptions(benchmarkRounds = 3, warmupRounds = 2, concurrency = 1)
// round: 0.00
public void isJavaVersionAtLeast() {
	boolean result = false;
	//
	result = SystemHelper.isJavaVersionAtLeast(1.2f);
	//
	System.out.println(result);
	assertTrue(result);
	//
	//
	result = SystemHelper.isJavaVersionAtLeast(9.9f);
	assertFalse(result);
	//
	result = SystemHelper.isJavaVersionAtLeast(1);
	assertTrue(result);
	//
	result = SystemHelper.isJavaVersionAtLeast(999);
	assertFalse(result);
}
 
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:22,代码来源:SystemHelperTest.java

示例11: dejgroup

import com.carrotsearch.junitbenchmarks.BenchmarkOptions; //导入依赖的package包/类
@BenchmarkOptions(benchmarkRounds = 3, warmupRounds = 2, concurrency = 1)
@Test
// round: 1.11, GC: 77
public void dejgroup() {
	LinkedList<String> list = mockLinkedList();
	byte[] value = SerializeHelperWithoutPool.jgroup(list);

	List<String> result = null;
	//
	int count = 500;
	for (int i = 0; i < count; i++) {
		result = SerializeHelperWithoutPool.dejgroup(value);
	}
	//
	System.out.println(result);
	assertCollectionEquals(list, result);
}
 
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:18,代码来源:SerializeHelperWithoutPoolTest.java

示例12: ___adler32InputStream

import com.carrotsearch.junitbenchmarks.BenchmarkOptions; //导入依赖的package包/类
@Test
@BenchmarkOptions(benchmarkRounds = 2, warmupRounds = 1, concurrency = 1)
// round: 0.19
public void ___adler32InputStream() throws Exception {
	byte[] value = new byte[307200];// 300k
	InputStream in = null;
	long result = 0;
	//
	final int COUNT = 1000;
	for (int i = 0; i < COUNT; i++) {
		in = new ByteArrayInputStream(value);
		result = ChecksumHelperWithoutPool.___adler32(in);
		in.close();
	}
	//
	System.out.println(result);// 2956722177
	assertEquals(2956722177L, result);
}
 
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:19,代码来源:ChecksumHelperWithoutPoolTest.java

示例13: dekryo

import com.carrotsearch.junitbenchmarks.BenchmarkOptions; //导入依赖的package包/类
@BenchmarkOptions(benchmarkRounds = 10, warmupRounds = 1, concurrency = 10)
@Test
// round: 1.02 [+- 0.10], round.block: 0.12 [+- 0.02], round.gc: 0.00 [+-
// 0.00], GC.calls: 7, GC.time: 0.04, time.total: 1.07, time.warmup: 0.00,
// time.bench: 1.07

// round: 6.27 [+- 1.76], round.block: 0.03 [+- 0.02], round.gc: 0.00 [+- 0.00],
// GC.calls: 4, GC.time: 0.07, time.total: 7.52, time.warmup: 0.00, time.bench:
// 7.52
public void dekryo() {
	List<Object> list = mockLinkedList();
	byte[] value = SerializeHelper.kryo(new Kryo(), list);

	List<Object> result = null;
	//
	result = SerializeHelper.dekryo(new Kryo(), value, LinkedList.class);
	//
	System.out.println(result.size());// 4
	assertCollectionEquals(list, result);
}
 
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:21,代码来源:SerializeHelperTest.java

示例14: defstWithFactory

import com.carrotsearch.junitbenchmarks.BenchmarkOptions; //导入依赖的package包/类
@BenchmarkOptions(benchmarkRounds = 10, warmupRounds = 1, concurrency = 10)
@Test
// fstConfiguration.getObjectInput

// round: 4.51 [+- 1.44], round.block: 0.06 [+- 0.05], round.gc: 0.00 [+- 0.00],
// GC.calls: 6, GC.time: 0.21, time.total: 5.13, time.warmup: 0.00, time.bench:
// 5.12
public void defstWithFactory() {
	List<Object> list = mockLinkedList();
	byte[] value = SerializeHelper.fstWithFactory(list);
	List<Object> result = null;
	//
	result = SerializeHelper.defstWithFactory(value);
	//
	System.out.println(result.size());
	assertCollectionEquals(list, result);
}
 
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:18,代码来源:SerializeHelperTest.java

示例15: writeToXml

import com.carrotsearch.junitbenchmarks.BenchmarkOptions; //导入依赖的package包/类
@Test
@BenchmarkOptions(benchmarkRounds = 1, warmupRounds = 0, concurrency = 1)
// round: 0.69 [+- 0.00], round.block: 0.00 [+- 0.00], round.gc: 0.00 [+-
// 0.00], GC.calls: 0, GC.time: 0.00, time.total: 0.69, time.warmup: 0.00,
// time.bench: 0.69
public void writeToXml() {
	SecurityProcessor processor = new SecurityProcessorImpl();
	//
	processor.setSecurity(true);
	processor.setSecurityType(SecurityType.DES_ECB_PKCS5Padding);
	processor.setSecurityKey("NotFarAway");
	//
	String result = CollectorHelper.writeToXml(SecurityProcessorImpl.class,
			processor);
	System.out.println(result);
	assertNotNull(result);
	//
	SecurityProcessor compare = new SecurityProcessorImpl();
	assertTrue(processor.getSecurityTypes() == compare.getSecurityTypes());
}
 
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:21,代码来源:SecurityProcessorImplTest.java


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