RFR: 8328572: JFR: Use Class.forPrimitiveName(String)

Chen Liang liach at openjdk.org
Thu May 16 13:06:04 UTC 2024


On Thu, 16 May 2024 12:10:17 GMT, Erik Gahlin <egahlin at openjdk.org> wrote:

>> 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.

Indeed, that sounds all good. If this becomes a performance issue, it should be fixed from java.lang.reflect instead.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/19235#discussion_r1603305660


More information about the hotspot-jfr-dev mailing list