RFR: 8291641: Optimize StackTraceElement.toString() [v3]

David Schlosnagle duke at openjdk.org
Tue Aug 2 14:05:50 UTC 2022


On Tue, 2 Aug 2022 13:52:30 GMT, Quan Anh Mai <duke at openjdk.org> wrote:

>> David Schlosnagle has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Estimate length
>
> src/java.base/share/classes/java/lang/StackTraceElement.java line 365:
> 
>> 363:                 + methodName.length() + 1
>> 364:                 + Math.max("Unknown Source".length(), Objects.requireNonNullElse(fileName, "").length()) + 1
>> 365:                 + Integer.stringSize(lineNumber) + 1;
> 
> `Integer.stringSize(lineNumber)` can be further simplify to `11`

inlined as 12 (combined with `1` for trailing `)`)

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

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


More information about the core-libs-dev mailing list