RFR: 8294062: Improve parsing performance of j.l.c.MethodTypeDesc [v2]

Adam Sotona asotona at openjdk.org
Wed Sep 21 16:49:32 UTC 2022


> Parsing performance of `j.l.c.MethodTypeDescriptor::ofDescriptor` can be significantly improved and add performance boost to intensive users.
> 
> Two main reasons have been identified and fixed in this patch:
> 
> First glitch is late insertion of return type to the first position of `j.u.ArrayList`, causing all previously parsed parameter types to shift using `System::arraycopy`.
> 
> Proposed patch inserts a placeholder for the return type first and replaces it with return type later.
> 
> Second performance degradation is in `MethodTypeDescriptor::skipOverFieldSignature`, where each identified class descriptor is exactly located by `String::indexOf`, extracted by `String::substring`, and passed for for the purpose of verification to `ConstantUtils::verifyUnqualifiedClassName`.
> 
> Proposed patch inlines the unqualified class name verification into `ConstantUtils::skipOverFieldSignature` parsing loop and so eliminates calls of `String::indexOf` and `String::substring`. Package private method `ConstantUtils::verifyUnqualifiedClassName` has no other use within the package, so it is removed.
> 
> Please review proposed performance improving patch.
> 
> Thanks,
> Adam

Adam Sotona has updated the pull request incrementally with one additional commit since the last revision:

  added comments to j.l.ConstantUtils::skipOverFieldSignature parser loop

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/10358/files
  - new: https://git.openjdk.org/jdk/pull/10358/files/e3fd40c0..80b8535a

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=10358&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=10358&range=00-01

  Stats: 5 lines in 1 file changed: 5 ins; 0 del; 0 mod
  Patch: https://git.openjdk.org/jdk/pull/10358.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/10358/head:pull/10358

PR: https://git.openjdk.org/jdk/pull/10358


More information about the core-libs-dev mailing list