RFR: 8256507: Add a micro benchmark for JDK-8153005
Weijun Wang
weijun at openjdk.java.net
Wed Nov 18 14:53:03 UTC 2020
On Wed, 18 Nov 2020 13:46:04 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:
>> This is a micro benchmark for various algorithm settings of PKCS keystores. Strong for new algorithms and weak for old ones. Different iteration counts are tried. The result should show that the current setting (strong10000) is more efficient than old setting (weak50000).
>
> test/micro/org/openjdk/bench/java/security/PKCS12KeyStores.java line 65:
>
>> 63: }
>> 64:
>> 65: static {
>
> Move these to
>
> @Setup
> public void setup() throws Exception {
> ...
> }
>
> This would save you a `try-catch` section, and harness would properly fail on setup exception.
Newbie on JMH. Is it worth designing the byte[] fields as static? I assume there will be different objects for different forks but only one for different threads?
> test/micro/org/openjdk/bench/java/security/PKCS12KeyStores.java line 137:
>
>> 135: "PBEWithSHA1AndDESede", "2048",
>> 136: "HmacPBESHA1", "2048");
>> 137: }
>
> Any reason why these methods are not inlined into `@Benchmark` methods right away? E.g. why it is not:
>
> @Benchmark
> public byte[] outweak2048() throws Exception {
> return out("PBEWithSHA1AndRC2_40", "2048",
> "PBEWithSHA1AndDESede", "2048",
> "HmacPBESHA1", "2048");
> }
I want to make the byte[] fields static so the out() and gen***() methods must be static, and there is a warning on using a static method as a `@Benchmark` method.
-------------
PR: https://git.openjdk.java.net/jdk/pull/1277
More information about the security-dev
mailing list