RFR: 8333364: Minor cleanup could be done in com.sun.crypto.provider [v4]
Sean Mullan
mullan at openjdk.org
Wed Jul 3 12:44:24 UTC 2024
On Tue, 2 Jul 2024 17:19:32 GMT, Mark Powers <mpowers at openjdk.org> wrote:
>> src/java.base/share/classes/com/sun/crypto/provider/ChaCha20Poly1305Parameters.java line 210:
>>
>>> 208: HexDumpEncoder encoder = new HexDumpEncoder();
>>> 209: return LINE_SEP + "nonce:" +
>>> 210: LINE_SEP + "[" + encoder.encodeBuffer(nonce) + "]";
>>
>> This is probably not a performance sensitive method, but another fix would be to keep `StringBuilder` but call append() for each part of the String. Causes fewer objects to be created. I could accept either fix though unless there is an obvious performance issue.
>
> I used JMH to benchmark both fixes and they measured the same. Then I remembered that the java compiler converts + operations to StringBuilder's append. I'll keep the proposed fix.
Yes, you are right.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/19535#discussion_r1664125520
More information about the security-dev
mailing list