Simplify toString() implementations in Integer and Long

wenshao shaojin.wensj at alibaba-inc.com
Thu Oct 23 13:56:58 UTC 2025


With the introduction of String.newStringWithLatin1Bytes, we can use it to simplify the toString methods of Integer and Long. By replacing the implementation that supports COMPACT_STRING = false with newStringWithLatin1Bytes, we gain the following benefits:
1. Simplified implementation
2. Strings with codeSize < 35 in Integer.toString(int) and Long.toString(long) can be inlined in C1, improving performance in early calls.
To make it easier to understand my proposal, I created a draft PR and hope to get your feedback. https://github.com/openjdk/jdk/pull/27929 <https://github.com/openjdk/jdk/pull/27929 >
-
Shaojin Wen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/core-libs-dev/attachments/20251023/adbbd532/attachment.htm>


More information about the core-libs-dev mailing list