RFR: 8349176: Speed up Integer/Long.toString via Unsafe.allocateUninitializedArray
Chen Liang
liach at openjdk.org
Sat Feb 1 00:51:59 UTC 2025
On Wed, 29 Jan 2025 16:36:24 GMT, Shaojin Wen <swen at openjdk.org> wrote:
> The byte[] allocated in Integer/Long.toString is fully filled, so we can use Unsafe.allocateUninitializedArray to create byte[] to improve performance.
src/java.base/share/classes/java/lang/StringConcatHelper.java line 559:
> 557: static byte[] newArray(int length) {
> 558: return (byte[]) UNSAFE.allocateUninitializedArray(byte.class, length);
> 559: }
I think we should keep this check, as string concatenation seems to use this to throw OOME.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23353#discussion_r1934548644
More information about the core-libs-dev
mailing list