Partial RE for Benchmark Tests

Aleksey Shipilev aleksey.shipilev at oracle.com
Mon Aug 11 23:17:08 UTC 2014


Hi Bernd,

On 08/12/2014 02:45 AM, Bernd Eckenfels wrote:
> JMH uses a regular expression to select the Benchmarks. While doing so
> (as I understand it) it reuqires a full match. This has the
> "disadvantage" that you always need to specify ".*MyBenchmark.*". Not
> everybody is used to this syntax and it is really seldomly needed.
> 
> How about changing this to a partial match with ^$ support: if you
> specify an expression and it is found inside the benchmark name, the
> benchmark will be selected. That way you can even specify Substrings
> and be done 99% of the time: MyBenchmark. If you need to be more
> speficic, you could: "^.*MyBenchmark\.[^.]+"
> 
> Is it worth coming up with a patch for it?

This is an interesting idea, but we need to think through what exactly
do we want: more use-cases, including the corner cases? Is there a
reference to what other regexp-accepting products do?

Your suggestion seems to amount to:
 1) Look for an explicit "^" at the beginning, add ".*" at the
beginning, otherwise.
 2) Look for an explicit "$" at the end, add ".*" at the end, otherwise.

Thanks,
-Aleksey.



More information about the jmh-dev mailing list