On Tue, 20 Sep 2022 13:08:20 GMT, Adam Sotona <asot...@openjdk.org> wrote:

> 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

This pull request has now been integrated.

Changeset: 9f90eb05
Author:    Adam Sotona <asot...@openjdk.org>
URL:       
https://git.openjdk.org/jdk/commit/9f90eb0524aba7bc40c574a067ce37ccfd8753b1
Stats:     44 lines in 1 file changed: 13 ins; 22 del; 9 mod

8294062: Improve parsing performance of j.l.c.MethodTypeDesc

Reviewed-by: psandoz

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

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

Reply via email to