RFR: 8331114: Further improve performance of MethodTypeDesc::descriptorString [v2]
Claes Redestad
redestad at openjdk.org
Thu Apr 25 14:04:34 UTC 2024
On Thu, 25 Apr 2024 13:38:56 GMT, Viktor Klang <vklang at openjdk.org> wrote:
>> Claes Redestad has updated the pull request incrementally with one additional commit since the last revision:
>>
>> comma-separated
>
> src/java.base/share/classes/java/lang/constant/MethodTypeDesc.java line 208:
>
>> 206: default String displayDescriptor() {
>> 207: int count = parameterCount();
>> 208: StringBuilder sb = new StringBuilder(24).append('(');
>
> 24 is chosen by fair dice-roll? :)
More or less: default capacity is 16, 24 is 1.5x that - a pretty typical growth factor. It also happens to be enough for very common descriptors such as `()Ljava/lang/Object;` while not too large to cause a regression on very small (and also very common) descriptors such as `()V`.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/18945#discussion_r1579533391
More information about the core-libs-dev
mailing list