On Tue, 16 May 2023 09:18:57 GMT, Aleksey Shipilev <sh...@openjdk.org> wrote:
>> One of our services has a hot path with AES/GCM cipher reuse. The JDK code >> reinitializes the session key on that path, and >> [JDK-8308105](https://bugs.openjdk.org/browse/JDK-8308105) shows up >> prominently there. >> >> Fixing [JDK-8308105](https://bugs.openjdk.org/browse/JDK-8308105) would take >> a while, as would likely require multiple patches in VM internals. >> Meanwhile, we can avoid the multiarray allocations in >> AESCrypt.makeSessionKey completely, reaping performance benefits. We can go >> even deeper: replace the multi-array with the flat array and drop >> `expandToSubKey` completely. >> >> Example original profile is in the bug. >> >> There are other things we can polish in that code, but experiments show >> those polishings have rather diminshed returns. >> >> On new benchmark: >> >> >> Benchmark Mode Cnt Score Error Units >> >> ## Mac M1 >> >> # Before >> AESReinit.test avgt 15 873,842 ± 6,911 ns/op >> >> # After >> AESReinit.test avgt 15 347,632 ± 8,764 ns/op ; <--- 2.5x faster >> >> ## Xeon, c6.8xlarge >> >> # Before >> AESReinit.test avgt 15 1524.307 ± 24.231 ns/op >> >> # After >> AESReinit.test avgt 15 554.727 ± 12.876 ns/op ; <--- 2.75x faster >> >> ## Graviton, m6g.4xlarge >> >> # Before >> AESReinit.test avgt 15 1913.492 ± 23.489 ns/op >> >> # After >> AESReinit.test avgt 15 639.701 ± 5.033 ns/op ; <--- 2.99x faster >> >> >> Additional testing: >> - [x] Benchmarks >> - [x] macos-aarch64-server-release, `jdk_security` >> - [x] linux-x86_64-server-fastdebug, `tier1 tier2 tier3` > > Aleksey Shipilev has updated the pull request incrementally with three > additional commits since the last revision: > > - Micro-optimizations > - Handle Kd > - Handle Ke Rechecked `jdk_security`, passes. Thanks! ------------- PR Comment: https://git.openjdk.org/jdk/pull/13996#issuecomment-1554093536