On Sat, 28 Sep 2024 17:15:43 GMT, Abdelhak Zaaim <d...@openjdk.org> wrote:
> We can improve performance by avoiding repeated array access in the loop. > Instead of accessing types[i] multiple times, we cache it in a local > variable. Here's the optimized version `for (int i = 0; i < count; i++) { > Type current = types[i]; if (!current.isCategory2_2nd()) { if (compressed != > i) { types[compressed] = current; } compressed++; } } ` This reduces overhead > from multiple array lookups. This will add one more store and one more load operation in the loop when there is no isCategory2_2nd. The classfile is optimized to be faster at startup and work better in interpreted mode or C1. ------------- PR Comment: https://git.openjdk.org/jdk/pull/21227#issuecomment-2381076305