I am trying to get an understanding of approximately how fast/slow an operation is.
I have written a JMH benchmark:
@Benchmark
@OutputTimeUnit(TimeUnit.MILLISECONDS)
@BenchmarkMode(Mode.SampleTime)
@Warmup(iterations = 5)
@Measurement(iterations = 5, time = 5, timeUnit = TimeUnit.SECONDS)
fun endToEndQuery(blackhole: Blackhole, benchmarkState: BenchmarkState) {
val executionResult =
benchmarkState.graphql.execute(
"""
query {
hsql {
PUBLIC {
POSTS(where: { ID: { _lt: 2 } }) {
ID
TITLE
}
}
}
}
"""
)
blackhole.consume(executionResult)
}
This gives the below results.
Is it correct to interpret these as saying "It takes on average ~2ms to perform graphql.execute()"?
Thank you in advance for any feedback =)
Iteration 1: 2.099 ±(99.9%) 0.034 ms/op
Iteration 2: 2.138 ±(99.9%) 0.086 ms/op
Iteration 3: 2.131 ±(99.9%) 0.037 ms/op
Iteration 4: 2.163 ±(99.9%) 0.039 ms/op
Iteration 5: 2.202 ±(99.9%) 0.037 ms/op
N = 11659
mean = 2.146 ±(99.9%) 0.023 ms/op
benchmark summary:
Benchmark Mode Cnt Score Error Units
Benchmarks.endToEndQuery sample 11659 2.146 ± 0.023 ms/op
Benchmarks.endToEndQuery:endToEndQuery·p0.00 sample 1.939 ms/op
Benchmarks.endToEndQuery:endToEndQuery·p0.50 sample 2.056 ms/op
Benchmarks.endToEndQuery:endToEndQuery·p0.90 sample 2.281 ms/op
Benchmarks.endToEndQuery:endToEndQuery·p0.95 sample 2.404 ms/op
Benchmarks.endToEndQuery:endToEndQuery·p0.99 sample 3.016 ms/op
Benchmarks.endToEndQuery:endToEndQuery·p0.999 sample 10.896 ms/op
Benchmarks.endToEndQuery:endToEndQuery·p0.9999 sample 48.382 ms/op
Benchmarks.endToEndQuery:endToEndQuery·p1.00 sample 55.181 ms/op