On Mon, 26 May 2025 12:00:02 GMT, Per Minborg <pminb...@openjdk.org> wrote:

>> I thought this would both increase cleaniness and reduce code size of the 
>> decode method. @minborg What do you think? This also removes one of the 
>> switches on COMPACT_STRING.
>
> I think it is better to keep the code smaller rather than saving 0.2 ns for 
> skipping the zero-length check, which might get optimized away anyhow.

That zero-length check in `String(char[], int, int, Void)` was done as an 
optimization, too, so would be good if we leveraged it in paths that currently 
miss out for consistency. It was done maybe not so much for speed but to reduce 
memory and allocation pressure (empty `String`s are surprisingly common in many 
apps).

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25290#discussion_r2107206228

Reply via email to