On Sun, 25 May 2025 12:54:03 GMT, Chen Liang <li...@openjdk.org> wrote:
>> private String(char[] value, int off, int len, Void sig) { >> if (len == 0) { >> this.value = "".value; >> this.coder = "".coder; >> return; >> } >> if (COMPACT_STRINGS) { >> byte[] val = StringUTF16.compress(value, off, len); >> this.coder = StringUTF16.coderFromArrayLen(val, len); >> this.value = val; >> return; >> } >> this.coder = UTF16; >> this.value = StringUTF16.toBytes(value, off, len); >> } >> >> >> This constructor has additional processing logic for len == 0. >> >> ValueObject may be used here in the future. I think it is better to keep the >> original structure. > > 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. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25290#discussion_r2107187594