RFR: 8328572: JFR: Use Class.forPrimitiveName(String)
Erik Gahlin
egahlin at openjdk.org
Thu May 16 12:13:09 UTC 2024
On Tue, 14 May 2024 23:29:06 GMT, Chen Liang <liach at openjdk.org> wrote:
>> Could I have a review of change that use Class.forPrimitiveName(String) instead checking against every primitive type.
>>
>> Testing: jdk/jdk/jfr
>>
>> Thanks
>> Erik
>
> src/jdk.jfr/share/classes/jdk/jfr/internal/util/Utils.java line 253:
>
>> 251: Object array = Array.newInstance(componentType, length);
>> 252: for (int index = 0; index < length; index++) {
>> 253: Array.set(array, index, values.get(index));
>
> Note that `Array.set` is slow (see [JDK-8051447](https://bugs.openjdk.org/browse/JDK-8051447)); yet this woudld be fine if this is not on hot code paths.
It happens when a recording file is parsed, typically the Category annotation, which means about 150-200 invocation per file. Don't think it matters.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/19235#discussion_r1603223963
More information about the hotspot-jfr-dev
mailing list