org.openjdk.jmh.annotations.Fork Java Examples

The following examples show how to use org.openjdk.jmh.annotations.Fork. 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: HttpTraceContextExtractBenchmark.java    From opentelemetry-java with Apache License 2.0 6 votes vote down vote up
/** Benchmark for measuring HttpTraceContext extract. */
@Benchmark
@BenchmarkMode({Mode.AverageTime})
@Fork(1)
@Measurement(iterations = 15, time = 1)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
@Warmup(iterations = 5, time = 1)
@OperationsPerInvocation(COUNT)
@Nullable
public Context measureExtract() {
  Context result = null;
  for (int i = 0; i < COUNT; i++) {
    result = httpTraceContext.extract(Context.ROOT, carriers.get(i), getter);
  }
  return result;
}
 
Example #2
Source File: DataSet.java    From cyclops with Apache License 2.0 6 votes vote down vote up
@Benchmark
@BenchmarkMode(Mode.SampleTime)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
@Warmup(
    iterations = 10
)
@Measurement(
    iterations = 10
)
@Fork(1)
public void guavaSet(){
    for(int i=0;i<10000;i++) {
        guava = com.google.common.collect.ImmutableList.<String>builder().addAll(guava.subList(0,i)).add(""+i).addAll(guava.subList(i+1,guava.size())).build();

    }
}
 
Example #3
Source File: VectorOps.java    From cyclops with Apache License 2.0 6 votes vote down vote up
@Benchmark
@BenchmarkMode(Mode.SampleTime)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
@Warmup(
    iterations = 10
)
@Measurement(
    iterations = 10
)
@Fork(1)
public void vavrOps() {
    js.map(i -> i * 2)
        .flatMap(i->Vector.range(0,10))
        .map(i -> i * 2)
        .filter(i -> i < 5000)
        .map(i -> "hello " + i)
        .zip(Vector.range(0,1000000))
        .map(i->i._1())
        .map(i -> i.length())
        .reduce((a, b) -> a + b);

}
 
Example #4
Source File: AWSXRayRecorderBenchmark.java    From aws-xray-sdk-java with Apache License 2.0 5 votes vote down vote up
@Benchmark
@BenchmarkMode(Mode.All)
@Fork(value=1)
@Warmup(iterations = 20)
@Measurement(iterations = 20)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public Segment getSegmentBenchmark(PopulatedRecorderState state) {
    return state.recorder.getCurrentSegment();
}
 
Example #5
Source File: VectorMap.java    From cyclops with Apache License 2.0 5 votes vote down vote up
@Benchmark
@BenchmarkMode(Mode.SampleTime)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
@Warmup(
    iterations = 10
)
@Measurement(
    iterations = 10
)
@Fork(1)
public void vectorOps() {
    vector.map(i -> i+ "2");

}
 
Example #6
Source File: ExecutorInstrumentationBenchmark.java    From opencensus-java with Apache License 2.0 5 votes vote down vote up
/**
 * This benchmark attempts to measure the performance with automatic context propagation.
 *
 * @param blackhole a {@link Blackhole} object supplied by JMH
 */
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
@Fork(jvmArgsAppend = "-javaagent:contrib/agent/build/libs/agent.jar")
public void automatic(final Blackhole blackhole) {
  MoreExecutors.directExecutor().execute(new MyRunnable(blackhole));
}
 
Example #7
Source File: CheckpointBenchmark.java    From reactor-core with Apache License 2.0 5 votes vote down vote up
@Benchmark()
@OutputTimeUnit(TimeUnit.MILLISECONDS)
@Warmup(iterations = 5, time = 1)
@Measurement(iterations = 5, time = 1)
@Fork(1)
@BenchmarkMode({Mode.Throughput, Mode.SampleTime})
public void withFullCheckpoint() {
	this.findAllUserByName(Flux.just("pedro", "simon", "stephane"))
	    .transform(f -> f.filter(s -> s.startsWith("s")))
	    .transform(f -> f.elapsed())
	    .checkpoint("checkpoint description", true)
	    .subscribe(System.out::println, t -> {
	    });
}
 
Example #8
Source File: ExecutorInstrumentationBenchmark.java    From opencensus-java with Apache License 2.0 5 votes vote down vote up
/**
 * This benchmark attempts to measure the performance with manual context propagation.
 *
 * @param blackhole a {@link Blackhole} object supplied by JMH
 */
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
@Fork
public void manual(final Blackhole blackhole) {
  MoreExecutors.directExecutor().execute(Context.current().wrap(new MyRunnable(blackhole)));
}
 
Example #9
Source File: SeqPrepend.java    From cyclops with Apache License 2.0 5 votes vote down vote up
@Benchmark
@BenchmarkMode(Mode.SampleTime)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
@Warmup(
    iterations = 10
)
@Measurement(
    iterations = 10
)
@Fork(1)
public void vavrOps() {
    for(int i=0;i<1000;i++)
        js =js.prepend(i);

}
 
Example #10
Source File: SeqMap.java    From cyclops with Apache License 2.0 5 votes vote down vote up
@Benchmark
@BenchmarkMode(Mode.SampleTime)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
@Warmup(
    iterations = 10
)
@Measurement(
    iterations = 10
)
@Fork(1)
public void cyclopsOps() {
    seq.map(i -> i * 2);

}
 
Example #11
Source File: CentralizedSamplingStrategyBenchmark.java    From aws-xray-sdk-java with Apache License 2.0 5 votes vote down vote up
@Benchmark
@BenchmarkMode(Mode.All)
@Fork(value=1)
@Warmup(iterations = 20)
@Measurement(iterations = 20)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public boolean noSampleSamplingBenchmark(NoSampleSamplingRulesState state) {
    return state.samplingStrategy.shouldTrace(state.samplingRequest).isSampled();
}
 
Example #12
Source File: CentralizedSamplingStrategyBenchmark.java    From aws-xray-sdk-java with Apache License 2.0 5 votes vote down vote up
@Benchmark
@BenchmarkMode(Mode.All)
@Fork(value=1)
@Warmup(iterations = 20)
@Measurement(iterations = 20)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public boolean defaultSamplingRuleBenchmark(DefaultSamplingRulesState state) {
    return state.samplingStrategy.shouldTrace(state.samplingRequest).isSampled();
}
 
Example #13
Source File: ThreadInstrumentationBenchmark.java    From opencensus-java with Apache License 2.0 5 votes vote down vote up
/**
 * This benchmark attempts to measure the performance with automatic context propagation.
 *
 * @param blackhole a {@link Blackhole} object supplied by JMH
 */
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MICROSECONDS)
@Fork(jvmArgsAppend = "-javaagent:contrib/agent/build/libs/agent.jar")
public void automatic(Blackhole blackhole) throws InterruptedException {
  Thread t = new Thread(new MyRunnable(blackhole));
  t.start();
  t.join();
}
 
Example #14
Source File: HttpFilterBenchmarks.java    From spring-cloud-sleuth with Apache License 2.0 5 votes vote down vote up
@Benchmark
@Measurement(iterations = 5, time = 1)
@Fork(3)
public void filterWithSleuth(BenchmarkContext context)
		throws ServletException, IOException {
	MockHttpServletRequest request = builder().buildRequest(new MockServletContext());
	MockHttpServletResponse response = new MockHttpServletResponse();
	response.setContentType(MediaType.APPLICATION_JSON_VALUE);

	context.tracingFilter.doFilter(request, response, new MockFilterChain());
}
 
Example #15
Source File: EntityBenchmark.java    From aws-xray-sdk-java with Apache License 2.0 5 votes vote down vote up
@Benchmark
@BenchmarkMode(Mode.All)
@Fork(value=1)
@Warmup(iterations = 20)
@Measurement(iterations = 20)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public Subsegment constructSubsegmentPutInSegmentBenchmark(BenchmarkState state) {
    // TODO: Find a way to create just the subsegment and not force it into the parent segment?
    return new SubsegmentImpl(state.recorder, SEGMENT_NAME, state.parentSegment);
}
 
Example #16
Source File: EntityBenchmark.java    From aws-xray-sdk-java with Apache License 2.0 5 votes vote down vote up
@Benchmark
@BenchmarkMode(Mode.All)
@Fork(value=1)
@Warmup(iterations = 20)
@Measurement(iterations = 20)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public Segment constructSegmentBenchmark(BenchmarkState state) {
    return new SegmentImpl(state.recorder, SEGMENT_NAME);
}
 
Example #17
Source File: AWSXRayRecorderBenchmark.java    From aws-xray-sdk-java with Apache License 2.0 5 votes vote down vote up
@Benchmark
@BenchmarkMode(Mode.All)
@Fork(value=1)
@Warmup(iterations = 20)
@Measurement(iterations = 20)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public Subsegment getSubsegmentBenchmark(PopulatedRecorderState state) {
    return state.recorder.getCurrentSubsegment();
}
 
Example #18
Source File: EntityBenchmark.java    From aws-xray-sdk-java with Apache License 2.0 5 votes vote down vote up
@Benchmark
@BenchmarkMode(Mode.All)
@Fork(value=1)
@Warmup(iterations = 20)
@Measurement(iterations = 20)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public void putExceptionSegmentBenchmark(BenchmarkState state) {
    state.parentSegment.addException(state.theException);
}
 
Example #19
Source File: AWSXRayRecorderBenchmark.java    From aws-xray-sdk-java with Apache License 2.0 5 votes vote down vote up
@Benchmark
@BenchmarkMode(Mode.All)
@Fork(value=1)
@Warmup(iterations = 20)
@Measurement(iterations = 20)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public void beginEndDummySegmentSubsegmentBenchmark(RecorderState state) {
    state.recorder.beginDummySegment();
    state.recorder.beginSubsegment(SUBSEGMENT_NAME);
    state.recorder.endSubsegment();
    state.recorder.endSegment();
}
 
Example #20
Source File: AWSXRayRecorderBenchmark.java    From aws-xray-sdk-java with Apache License 2.0 5 votes vote down vote up
@Benchmark
@BenchmarkMode(Mode.All)
@Fork(value=1)
@Warmup(iterations = 20)
@Measurement(iterations = 20)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public void beginEndSegmentSubsegmentBenchmark(RecorderState state) {
    state.recorder.beginSegment(SEGMENT_NAME);
    state.recorder.beginSubsegment(SUBSEGMENT_NAME);
    state.recorder.endSubsegment();
    state.recorder.endSegment();
}
 
Example #21
Source File: AWSXRayRecorderBenchmark.java    From aws-xray-sdk-java with Apache License 2.0 5 votes vote down vote up
@Benchmark
@BenchmarkMode(Mode.All)
@Fork(value=1)
@Warmup(iterations = 20)
@Measurement(iterations = 20)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public void endSubsegmentBenchmark(PopulatedRecorderState state) {
    state.recorder.endSubsegment();
}
 
Example #22
Source File: SeqMap.java    From cyclops with Apache License 2.0 5 votes vote down vote up
@Benchmark
@BenchmarkMode(Mode.SampleTime)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
@Warmup(
    iterations = 10
)
@Measurement(
    iterations = 10
)
@Fork(1)
public void vavrOps() {
    js.map(i -> i * 2);

}
 
Example #23
Source File: VectorMap.java    From cyclops with Apache License 2.0 5 votes vote down vote up
@Benchmark
@BenchmarkMode(Mode.SampleTime)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
@Warmup(
    iterations = 10
)
@Measurement(
    iterations = 10
)
@Fork(1)
public void vavrOps() {
    js.map(i -> i+ "2");

}
 
Example #24
Source File: AWSXRayRecorderBenchmark.java    From aws-xray-sdk-java with Apache License 2.0 5 votes vote down vote up
@Benchmark
@BenchmarkMode(Mode.All)
@Fork(value=1)
@Warmup(iterations = 20)
@Measurement(iterations = 20)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public Subsegment beginSubsegmentBenchmark(SegmentNoChildRecorderState state) {
    return state.recorder.beginSubsegment(SUBSEGMENT_NAME);
}
 
Example #25
Source File: AWSXRayRecorderBenchmark.java    From aws-xray-sdk-java with Apache License 2.0 5 votes vote down vote up
@Benchmark
@BenchmarkMode(Mode.All)
@Fork(value=1)
@Warmup(iterations = 20)
@Measurement(iterations = 20)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public void beginEndSegmentBenchmark(RecorderState state) {
    state.recorder.beginSegment(SEGMENT_NAME);
    state.recorder.endSegment();
}
 
Example #26
Source File: AWSXRayRecorderBenchmark.java    From aws-xray-sdk-java with Apache License 2.0 5 votes vote down vote up
@Benchmark
@BenchmarkMode(Mode.All)
@Fork(value=1)
@Warmup(iterations = 20)
@Measurement(iterations = 20)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public void endSegmentNoChildBenchmark(SegmentNoChildRecorderState state) {
    state.recorder.endSegment();
}
 
Example #27
Source File: AWSXRayRecorderBenchmark.java    From aws-xray-sdk-java with Apache License 2.0 5 votes vote down vote up
@Benchmark
@BenchmarkMode(Mode.All)
@Fork(value=1)
@Warmup(iterations = 20)
@Measurement(iterations = 20)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public void endSegmentWithChildBenchmark(PopulatedRecorderState state) {
    state.recorder.endSubsegment();
    state.recorder.endSegment();
}
 
Example #28
Source File: AWSXRayRecorderBenchmark.java    From aws-xray-sdk-java with Apache License 2.0 5 votes vote down vote up
@Benchmark
@BenchmarkMode(Mode.All)
@Fork(value=1)
@Warmup(iterations = 20)
@Measurement(iterations = 20)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public void endSegmentBenchmark(SegmentNoChildRecorderState state) {
    state.recorder.endSegment();
}
 
Example #29
Source File: VectorFoldLeft.java    From cyclops with Apache License 2.0 5 votes vote down vote up
@Benchmark
@BenchmarkMode(Mode.SampleTime)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
@Warmup(
    iterations = 10
)
@Measurement(
    iterations = 10
)
@Fork(1)
public void cyclopsOps() {
    vector.foldLeft((a,b)->a+b);

}
 
Example #30
Source File: AWSXRayRecorderBenchmark.java    From aws-xray-sdk-java with Apache License 2.0 5 votes vote down vote up
@Benchmark
@BenchmarkMode(Mode.All)
@Fork(value=1)
@Warmup(iterations = 20)
@Measurement(iterations = 20)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public Segment beginDummySegmentBenchmark(RecorderState state) {
    return state.recorder.beginDummySegment();
}