RFR: 8356126: Duplication handling and optimization of CaptureCallState [v5]
Chen Liang
liach at openjdk.org
Tue May 6 15:51:55 UTC 2025
On Tue, 6 May 2025 11:56:04 GMT, Per Minborg <pminborg at openjdk.org> wrote:
>> Chen Liang has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Review remarks
>
> src/java.base/share/classes/jdk/internal/foreign/abi/CapturableState.java line 81:
>
>> 79:
>> 80: public static CapturableState forName(String name) {
>> 81: var ret = LOOKUP.get(name);
>
> As we usually have just one element (and for Windows three elements) it might be both less memory consuming and faster to just search a `@Stable` array linearly rather than having a Map.
`Map.get` still has cleaner code than an array iteration, and there is already a Map1 optimized implementation. I think map is more friendly in the long run.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25025#discussion_r2075767137
More information about the core-libs-dev
mailing list