advice on usage of jmh

Jochen Theodorou blackdrag at gmx.org
Wed Sep 16 18:34:06 UTC 2015


Hi all,

this might not be the right place to as, but I did not find a users 
lists so I thought I am going to ask here. If here is a better list for 
this, please tell me.

I have an old pseudo benchmark which I would like to use jmh for. The 
benchmark 
(https://github.com/pcollections/pcollections/blob/master/src/test/java/org/pcollections/tests/Benchmarks.java) 
is testing different methods on different sets of collections. For 
example containsKey is tested for HashMap, HashTreePMap and IntTreePMap. 
The test is done with two lists of keys, of which one is just a sequence 
of continuous numbers and the other list contains random numbers.

My problem is, that when ever I try to rewrite this into something using 
JMH the code size explodes. Instead of a single generic method for 
containsKey I end up with one for each map type, plus.. then I thought I 
could use enums to make this more easy, but then I found out that @Param 
does not allow me to select the enum values I want to go through. The 
only way I can imagine to keep the codesize halfway down right now, is 
to use int and index in data structures since I can select the values here.

Is that really the way to go? My gut feeling says no. So any advice on 
this from you guys?

bye Jochen

-- 
Jochen "blackdrag" Theodorou
blog: http://blackdragsview.blogspot.com/



More information about the jmh-dev mailing list