<i18n dev> RFR: 8367703: Unneeded cast in java.text.DigitList.append
Justin Lu
jlu at openjdk.org
Mon Sep 15 22:39:12 UTC 2025
On Mon, 15 Sep 2025 21:44:35 GMT, Roger Riggs <rriggs at openjdk.org> wrote:
> Is there any observable/measureable performance difference? The byte type is a bit of a hack, while char is semantically more precise.
There is negligible performance impact. I filed this change not for performance, but rather simplifying the code path for readability because in the domain of DigitList, `digits` is a byte array and always composed of code points 48 to 57. With this context, passing it directly as a byte avoided an extra level of conversion and should be reasonable to the reader.
In general, I understand the result of `(digit + '0')` as a char is semantically more precise; I can withdraw this PR if you think it hurts readability (since the goal is the opposite of that).
-------------
PR Comment: https://git.openjdk.org/jdk/pull/27300#issuecomment-3294205443
More information about the i18n-dev
mailing list