RFR: 8333833: UUID toString removes the use of ByteArrayLittleEndian [v5]

Claes Redestad redestad at openjdk.org
Sun Jun 9 20:00:13 UTC 2024


On Sun, 9 Jun 2024 07:22:39 GMT, Shaojin Wen <duke at openjdk.org> wrote:

>> After PR #16245, C2 optimizes stores into primitive arrays by combining values ​​into larger stores. In the UUID.toString method, ByteArrayLittleEndian can be removed, making the code more elegant and faster.
>
> Shaojin Wen has updated the pull request incrementally with two additional commits since the last revision:
> 
>  - rename putHex4 to put4
>  - update copy right year

Glad to see #16245 in action, enabling simpler code with equal or better performance.

src/java.base/share/classes/jdk/internal/util/HexDigits.java line 123:

> 121:      * @param i to convert
> 122:      */
> 123:     public static void put4(byte[] buffer, int off, int i) {

Perhaps `index` and `value` are better names than `off` and `i`, respectively.

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

Marked as reviewed by redestad (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/19610#pullrequestreview-2106355754
PR Review Comment: https://git.openjdk.org/jdk/pull/19610#discussion_r1632380045


More information about the core-libs-dev mailing list