Benchmark display name
Aleksey Shipilev
shade at redhat.com
Thu Apr 15 15:30:52 UTC 2021
On 3/31/21 9:10 AM, Zheka Kozlov wrote:
> I would like to request a feature for JMH. Can we introduce a way to
> specify human-readable names for benchmark methods? Something like:
>
> @Benchmark("Benchmark description here")
> public void benchmark() {
> }
>
> Or:
>
> @DisplayName("Benchmark description here")
> @Benchmark
> public void benchmark() {
> }
>
> Is this possible?
It is technically possible, but I would refrain from extending the annotation API without a very
pressing need. Let me ask this: can you show where the current naming scheme becomes a problem that
is (only) solvable by a new API?
Current scheme gives us at least two good properties for free:
a) the benchmark names are legal Java identifiers, which frees us from checking the names for
oddities (newlines, special symbols, injected garbage, etc) -- which also gets funky when you
consider result formats that might have their own opinions on what is permitted;
b) the benchmark names are guaranteed to be unique due to Java language rules;
--
Thanks,
-Aleksey
More information about the jmh-dev
mailing list