On Thu, 18 Jul 2024 05:21:36 GMT, Shaojin Wen <d...@openjdk.org> wrote:
> class LocalDate { > public String toString() { > if (absYear < 1000) { > if (yearValue < 0) { > buf.append(yearValue - 10000).deleteCharAt(1); > } else { > buf.append(yearValue + 10000).deleteCharAt(0); > } > // ... > } > } > > Currently, LocalDate.toString causes an extra memory copy when processing > years < 1000. This can be replaced by using StringBuilder.repeat, which is > more concise and has better performance. lgtm ------------- Marked as reviewed by rriggs (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/20229#pullrequestreview-2189421346