com.carrotsearch.junitbenchmarks.BenchmarkOptions Java Examples
The following examples show how to use
com.carrotsearch.junitbenchmarks.BenchmarkOptions.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JUnitBenchmarkProvider.java From titan1withtp3.1 with Apache License 2.0 | 6 votes |
@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(); }
Example #2
Source File: IndexBenchmark.java From public-suffix-list with Do What The F*ck You Want To Public License | 6 votes |
@BenchmarkOptions( benchmarkRounds = 20000, warmupRounds = 2000, concurrency = BenchmarkOptions.CONCURRENCY_AVAILABLE_CORES) @Test public void benchmarkFindRule() throws Exception { index.findRule(RandomStringUtils.random(2)); index.findRule(RandomStringUtils.random(2)); index.findRule(RandomStringUtils.random(2)); index.findRule(RandomStringUtils.random(2)); index.findRule(RandomStringUtils.random(2)); index.findRule(RandomStringUtils.random(2)); index.findRule("www.global.prod.fastly.net"); index.findRule(RandomStringUtils.random(2)); index.findRule(RandomStringUtils.random(2)); index.findRule(RandomStringUtils.random(2)); index.findRule(RandomStringUtils.random(2)); }
Example #3
Source File: GetRegistrableDomainTest.java From public-suffix-list with Do What The F*ck You Want To Public License | 6 votes |
@BenchmarkOptions( benchmarkRounds = 10000, concurrency = BenchmarkOptions.CONCURRENCY_AVAILABLE_CORES) @Test public void testGetRegistrableDomain() throws IOException { for (String[] tupel : TestUtil.getCheckPublicSuffixCases()) { String domain = tupel[0]; String registrableDomain = tupel[1]; String actual = StringUtils.lowerCase(psl.getRegistrableDomain(domain)); String expected = StringUtils.lowerCase(registrableDomain); assertEquals( String.format("%s should return %s, but was %s", domain, expected, actual), expected, actual ); } }
Example #4
Source File: RandomWritingBenchmarkTest.java From parquet-mr with Apache License 2.0 | 5 votes |
@BenchmarkOptions(benchmarkRounds = 10, warmupRounds = 2) @Test public void writeDeltaPackingTest(){ DeltaBinaryPackingValuesWriter writer = new DeltaBinaryPackingValuesWriterForInteger( blockSize, miniBlockNum, 100, 20000, new DirectByteBufferAllocator()); runWriteTest(writer); }
Example #5
Source File: ScriptRunnerBenchmark.java From citeproc-java with Apache License 2.0 | 5 votes |
/** * Tests the GraalVM JavaScript script runner * @throws Exception if something goes wrong */ @BenchmarkOptions(benchmarkRounds = 10, warmupRounds = 1) @Test @Ignore("Should not be called together with other tests because it sets " + "CSL.sharedRunner, which cannot be reset") public void graaljs() throws Exception { RunnerType prev = ScriptRunnerFactory.setRunnerType(RunnerType.GRAALJS); try { runTest(); } finally { ScriptRunnerFactory.setRunnerType(prev); } }
Example #6
Source File: ScriptRunnerBenchmark.java From citeproc-java with Apache License 2.0 | 5 votes |
/** * Tests the JRE script runner * @throws Exception if something goes wrong */ @BenchmarkOptions(benchmarkRounds = 10, warmupRounds = 1) @Test @Ignore("Should not be called together with other tests because it sets " + "CSL.sharedRunner, which cannot be reset") public void jre() throws Exception { RunnerType prev = ScriptRunnerFactory.setRunnerType(RunnerType.JRE); try { runTest(); } finally { ScriptRunnerFactory.setRunnerType(prev); } }
Example #7
Source File: PropertiesBasedTraceeFilterConfigurationBenchmarkTest.java From tracee with BSD 3-Clause "New" or "Revised" License | 5 votes |
@BenchmarkOptions(benchmarkRounds = 1, warmupRounds = 1) @Test @Ignore public void shouldAllowTraceePrefixedParameters() { System.setProperty(PropertiesBasedTraceeFilterConfiguration.TRACEE_DEFAULT_PROFILE_PREFIX + CHANNEL, "tracee.*"); for (int i = 0; i < 2000000; i++) { final Map<String, String> filteredProperties = unit.filterDeniedParams(propertyMap, CHANNEL); assertThat(filteredProperties.size(), is(2)); } }
Example #8
Source File: PropertiesBasedTraceeFilterConfigurationBenchmarkTest.java From tracee with BSD 3-Clause "New" or "Revised" License | 5 votes |
@BenchmarkOptions(benchmarkRounds = 1, warmupRounds = 1) @Test @Ignore public void shouldPermitAll() { for (int i = 0; i < 2000000; i++) { final Map<String, String> filteredProperties = unit.filterDeniedParams(propertyMap, CHANNEL); assertThat(filteredProperties.size(), is(4)); } }
Example #9
Source File: IbanBenchmark.java From iban4j with Apache License 2.0 | 5 votes |
@BenchmarkOptions(benchmarkRounds = 3, warmupRounds = 1) @Test @Ignore public void ibanValidation() { for(int i = 0; i < LOOPS_COUNT; i++) { IbanUtil.validate("DE89370400440532013000"); } }
Example #10
Source File: IbanBenchmark.java From iban4j with Apache License 2.0 | 5 votes |
@BenchmarkOptions(benchmarkRounds = 3, warmupRounds = 1) @Test @Ignore public void ibanConstruction() { for(int i = 0; i < LOOPS_COUNT; i++) { Iban iban = new Iban.Builder() .countryCode(CountryCode.DE) .bankCode("52060170") .accountNumber("0012335785") .build(); } }
Example #11
Source File: BenchmarkDeltaByteArray.java From parquet-mr with Apache License 2.0 | 5 votes |
@BenchmarkOptions(benchmarkRounds = 20, warmupRounds = 4) @Test public void benchmarkSortedStringsWithDeltaLengthByteArrayValuesWriter() throws IOException { DeltaByteArrayWriter writer = new DeltaByteArrayWriter(64 * 1024, 64 * 1024, new DirectByteBufferAllocator()); DeltaByteArrayReader reader = new DeltaByteArrayReader(); Utils.writeData(writer, sortedVals); ByteBufferInputStream data = writer.getBytes().toInputStream(); Utils.readData(reader, data, values.length); System.out.println("size " + data.position()); }
Example #12
Source File: BenchmarkDeltaByteArray.java From parquet-mr with Apache License 2.0 | 5 votes |
@BenchmarkOptions(benchmarkRounds = 20, warmupRounds = 4) @Test public void benchmarkSortedStringsWithPlainValuesWriter() throws IOException { PlainValuesWriter writer = new PlainValuesWriter(64 * 1024, 64 * 1024, new DirectByteBufferAllocator()); BinaryPlainValuesReader reader = new BinaryPlainValuesReader(); Utils.writeData(writer, sortedVals); ByteBufferInputStream data = writer.getBytes().toInputStream(); Utils.readData(reader, data, values.length); System.out.println("size " + data.position()); }
Example #13
Source File: BenchmarkDeltaByteArray.java From parquet-mr with Apache License 2.0 | 5 votes |
@BenchmarkOptions(benchmarkRounds = 20, warmupRounds = 4) @Test public void benchmarkRandomStringsWithDeltaLengthByteArrayValuesWriter() throws IOException { DeltaByteArrayWriter writer = new DeltaByteArrayWriter(64 * 1024, 64 * 1024, new DirectByteBufferAllocator()); DeltaByteArrayReader reader = new DeltaByteArrayReader(); Utils.writeData(writer, values); ByteBufferInputStream data = writer.getBytes().toInputStream(); Utils.readData(reader, data, values.length); System.out.println("size " + data.position()); }
Example #14
Source File: BenchmarkDeltaByteArray.java From parquet-mr with Apache License 2.0 | 5 votes |
@BenchmarkOptions(benchmarkRounds = 20, warmupRounds = 4) @Test public void benchmarkRandomStringsWithPlainValuesWriter() throws IOException { PlainValuesWriter writer = new PlainValuesWriter(64 * 1024, 64 * 1024, new DirectByteBufferAllocator()); BinaryPlainValuesReader reader = new BinaryPlainValuesReader(); Utils.writeData(writer, values); ByteBufferInputStream data = writer.getBytes().toInputStream(); Utils.readData(reader, data, values.length); System.out.println("size " + data.position()); }
Example #15
Source File: RandomWritingBenchmarkTest.java From parquet-mr with Apache License 2.0 | 5 votes |
@BenchmarkOptions(benchmarkRounds = 10, warmupRounds = 2) @Test public void writeDeltaPackingTest2(){ DeltaBinaryPackingValuesWriter writer = new DeltaBinaryPackingValuesWriterForInteger( blockSize, miniBlockNum, 100, 20000, new DirectByteBufferAllocator()); runWriteTest(writer); }
Example #16
Source File: ParallelAccessTest.java From jerseyoauth2 with MIT License | 5 votes |
@Ignore @BenchmarkOptions(benchmarkRounds=200, concurrency=BenchmarkOptions.CONCURRENCY_AVAILABLE_CORES) @Test public void testParallelResourceAccess() throws ClientException { SampleEntity entity = client.retrieveEntitySample1(token); assertNotNull(entity); assertEquals("manager", entity.getUsername()); assertEquals(clientEntity.getClientId(), entity.getClientApp()); }
Example #17
Source File: BenchmarkReadingRandomIntegers.java From parquet-mr with Apache License 2.0 | 5 votes |
@BenchmarkOptions(benchmarkRounds = 20, warmupRounds = 10) @Test public void readingRLE() throws IOException { for (int j = 0; j < 10; j++) { ValuesReader reader = new RunLengthBitPackingHybridValuesReader(32); readData(reader, rleBytes); } }
Example #18
Source File: BenchmarkReadingRandomIntegers.java From parquet-mr with Apache License 2.0 | 5 votes |
@BenchmarkOptions(benchmarkRounds = 20, warmupRounds = 10) @Test public void readingDelta() throws IOException { for (int j = 0; j < 10; j++) { DeltaBinaryPackingValuesReader reader = new DeltaBinaryPackingValuesReader(); readData(reader, deltaBytes); } }
Example #19
Source File: ResourceAccessTest.java From jerseyoauth2 with MIT License | 5 votes |
@Ignore @BenchmarkOptions(benchmarkRounds=200, concurrency=BenchmarkOptions.CONCURRENCY_SEQUENTIAL) @Test public void testResourceAccessWithRefresh() throws ClientException { testCount++; if (testCount % 50 == 0 && testCount>0) token = client.refreshToken((OAuth2Token)token); SampleEntity entity = client.retrieveEntitySample1(token); assertNotNull(entity); assertEquals("manager", entity.getUsername()); assertEquals(clientEntity.getClientId(), entity.getClientApp()); }
Example #20
Source File: BenchmarkDeltaLengthByteArray.java From parquet-mr with Apache License 2.0 | 5 votes |
@BenchmarkOptions(benchmarkRounds = 20, warmupRounds = 4) @Test public void benchmarkRandomStringsWithDeltaLengthByteArrayValuesWriter() throws IOException { DeltaLengthByteArrayValuesWriter writer = new DeltaLengthByteArrayValuesWriter(64 * 1024, 64 * 1024, new DirectByteBufferAllocator()); DeltaLengthByteArrayValuesReader reader = new DeltaLengthByteArrayValuesReader(); Utils.writeData(writer, values); ByteBufferInputStream data = writer.getBytes().toInputStream(); Utils.readData(reader, data, values.length); System.out.println("size " + data.position()); }
Example #21
Source File: BenchmarkDeltaLengthByteArray.java From parquet-mr with Apache License 2.0 | 5 votes |
@BenchmarkOptions(benchmarkRounds = 20, warmupRounds = 4) @Test public void benchmarkRandomStringsWithPlainValuesWriter() throws IOException { PlainValuesWriter writer = new PlainValuesWriter(64 * 1024, 64 * 1024, new DirectByteBufferAllocator()); BinaryPlainValuesReader reader = new BinaryPlainValuesReader(); Utils.writeData(writer, values); ByteBufferInputStream data = writer.getBytes().toInputStream(); Utils.readData(reader, data, values.length); System.out.println("size " + data.position()); }
Example #22
Source File: FindRuleNonDetermenisticConcurrentTest.java From public-suffix-list with Do What The F*ck You Want To Public License | 5 votes |
@BenchmarkOptions( benchmarkRounds = 5000, concurrency = BenchmarkOptions.CONCURRENCY_AVAILABLE_CORES) @Test public void benchmarkFindRule() throws Exception { assertEquals( "global.prod.fastly.net", index.findRule("www.global.prod.fastly.net").getPattern()); }
Example #23
Source File: KafkaAppenderBenchmark.java From logback-kafka-appender with Apache License 2.0 | 5 votes |
@Ignore @BenchmarkOptions(benchmarkRounds = 10, warmupRounds = 2, concurrency = 8) @Test public void benchmark() throws InterruptedException { for (int i = 0; i < 100000; ++i) { logger.info("A VERY IMPORTANT LOG MESSAGE {}", i); } }
Example #24
Source File: JUnitBenchmarkProvider.java From titan1withtp3.1 with Apache License 2.0 | 5 votes |
@Override public Statement apply(Statement base, Description description) { Class<?> clazz = description.getTestClass(); String mname = description.getMethodName(); Collection<Annotation> annotations = description.getAnnotations(); final int rounds = getRoundsForFullMethodName(clazz.getCanonicalName() + "." + mname); List<Annotation> modifiedAnnotations = new ArrayList<Annotation>(annotations.size()); boolean hit = false; for (Annotation a : annotations) { if (a.annotationType().equals(BenchmarkOptions.class)) { final BenchmarkOptions old = (BenchmarkOptions)a; BenchmarkOptions replacement = getWrappedBenchmarkOptions(old, rounds); modifiedAnnotations.add(replacement); log.debug("Modified BenchmarkOptions annotation on {}", mname); hit = true; } else { modifiedAnnotations.add(a); log.debug("Kept annotation {} with annotation type {} on {}", new Object[] { a, a.annotationType(), mname }); } } if (!hit) { BenchmarkOptions opts = getDefaultBenchmarkOptions(rounds); modifiedAnnotations.add(opts); log.debug("Added BenchmarkOptions {} with annotation type {} to {}", new Object[] { opts, opts.annotationType(), mname }); } Description roundsAdjustedDesc = Description.createTestDescription( clazz, mname, modifiedAnnotations.toArray(new Annotation[modifiedAnnotations.size()])); return rule.apply(base, roundsAdjustedDesc); }
Example #25
Source File: FastSplitBenchmark.java From java-tool with Apache License 2.0 | 4 votes |
@Test @BenchmarkOptions(warmupRounds = 1, benchmarkRounds = 1) public void testFastSplit() { S.List sl = S.fastSplit(toBeSplited, "**"); UtilTestBase.eq(sl, C.listOf(toBeSplited.split("\\*\\*"))); }
Example #26
Source File: BitmapBenchmark.java From bytebuffer-collections with Apache License 2.0 | 4 votes |
@Test @BenchmarkOptions(warmupRounds = 1, benchmarkRounds = 5) public void timeGenericConciseIntersection() throws Exception { ImmutableBitmap intersection = conciseFactory.intersection(Lists.newArrayList(genericConcise)); Assert.assertTrue(intersection.size() >= minIntersection); }
Example #27
Source File: BitmapBenchmark.java From bytebuffer-collections with Apache License 2.0 | 4 votes |
@Test @BenchmarkOptions(warmupRounds = 1, benchmarkRounds = 2) public void timeConciseUnion() throws Exception { ImmutableConciseSet union = ImmutableConciseSet.union(concise); Assert.assertEquals(unionCount, union.size()); }
Example #28
Source File: BitmapBenchmark.java From bytebuffer-collections with Apache License 2.0 | 4 votes |
@Test @BenchmarkOptions(warmupRounds = 1, benchmarkRounds = 2) public void timeOffheapConciseUnion() throws Exception { ImmutableConciseSet union = ImmutableConciseSet.union(offheapConcise); Assert.assertEquals(unionCount, union.size()); }
Example #29
Source File: BitmapBenchmark.java From bytebuffer-collections with Apache License 2.0 | 4 votes |
@Test @BenchmarkOptions(warmupRounds = 1, benchmarkRounds = 2) public void timeGenericConciseUnion() throws Exception { ImmutableBitmap union = conciseFactory.union(Lists.newArrayList(genericConcise)); Assert.assertEquals(unionCount, union.size()); }
Example #30
Source File: JUnitBenchmarkProvider.java From titan1withtp3.1 with Apache License 2.0 | 4 votes |
private static BenchmarkOptions getDefaultBenchmarkOptions(int rounds) { return (BenchmarkOptions)Proxy.newProxyInstance( JUnitBenchmarkProvider.class.getClassLoader(), // which classloader is correct? new Class[] { BenchmarkOptions.class }, new DefaultBenchmarkOptionsHandler(rounds)); }