Reputation: 7397
I want to benchmark a program (using JMH) that reads data from a file and then measure the performance.
The name of files are stored as a list. The problem is that @Param
only takes constant expressions, so in a way it means that I need to statically encode all the file names in @Param
, which does not look good.
Is there another way, to run a benchmark for different files without static encoding?
Upvotes: 3
Views: 1706
Reputation: 18857
Yes, use the Java API, as every JMH sample shows:
Options opt = new OptionsBuilder()
.include(JMHSample_27_Params.class.getSimpleName())
.param("arg", "41", "42")
.build();
new Runner(opt).run();
Upvotes: 6