Measuring performance changes from applying 4837946 patch
aleksey.shipilev at oracle.com
Wed Jun 5 15:26:43 UTC 2013
On 06/05/2013 07:13 PM, Brian Burkhalter wrote:
> Hi Sergey,
>> b) the annotations you are using on each method, can flow up to
>> class-level annotation, and will be inherited by all the @GMB methods;
> I was not aware of this.
Yes, and with the daizy-fresh JMH, it is even possible to move the
remaining data upwards to the class level:
>> c) it is a good idea to initialize the State fields within the @Setup
>> method, because we guarantee correct initialization JMM-wise (try to run
>> your benchmark on non-x86 hardware, and you can occasionally see the
>> NPEs, because genericFactor1/2 might be null; you can also make the same
>> effect with "final" on fields, but that wouldn't be the generic case).
> That is good to know also. I read about State Fixtures but did not know
> of this behavior.
I take that back, the JMH samples are correct. JMH will initialize the
states with the worker threads, and publish it properly for you. You can
keep the init the way you have it now. The only culprit is that if State
is getting reused between the benchmark runs, it is a good idea to
re-initialize it with @Setup. But, since BigIntegers are "immutable",
you don't actually care.
More information about the core-libs-dev