On Fri, 14 Feb 2025 16:43:32 GMT, Ben Perez <bpe...@openjdk.org> wrote:
> It turns out that initializing a multidimensional array with `int[][] a = new > int[rows][cols]` is slower than allocating each column in a loop. Since we do > a lot of large multidimensional array allocations in ML-DSA, the optimized > initialization improves performance by roughly 10%. src/java.base/share/classes/sun/security/provider/ML_DSA.java line 1237: > 1235: return res; > 1236: } > 1237: Centralizing the allocation into a helper on its own Looks unseful (for resource Management, debugging/profiling and to pick the optimal implementation). but it’s a shame that 2 dimensional allocations are sub-optimal, shouldnt that be addressed in the jvm (or c2?) ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/23642#discussion_r1956478480