On Thu, 14 Nov 2024 17:20:14 GMT, Artur Barashev <abaras...@openjdk.org> wrote:

>> Volodymyr Paprotski has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   comments from Kevin
>
> src/java.base/share/classes/com/sun/crypto/provider/CipherBlockChaining.java 
> line 222:
> 
>> 220:         processed +=
>> 221:             implDecrypt(cipher, cipherOffset, cipherLen, plain, 
>> plainOffset);
>> 222:         return processed;
> 
> The `for` loop logic is the same for encrypt and decrypt operations, only 
> different positioning of the arguments. How about creating a helper method 
> `chunkOperation` that would take one additional encrypt/decrypt boolean 
> argument based on which it would do either encrypt or decrypt operation.

Given this is a performance change, I'm fine with leaving it as is.  Jumping to 
a helper method with an encrypt/decrypt conditional check for every crypto op 
will costs performance.  This is a case where more efficient code is more 
verbose syntax.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/22086#discussion_r1842871281

Reply via email to