RFR: 8316426: Optimization for HexFormat.formatHex [v6]

Roger Riggs rriggs at openjdk.org
Tue Sep 19 14:16:43 UTC 2023


On Tue, 19 Sep 2023 10:41:51 GMT, 温绍锦 <duke at openjdk.org> wrote:

>> In the improvement of @cl4es PR #15591, the advantages of non-lookup-table were discussed.
>> 
>> But if the input is byte[], using lookup table can improve performance.
>> 
>> For HexFormat#formatHex(Appendable, byte[]) and HexFormat#formatHex(byte[]), If the length of byte[] is larger, the performance of table lookup will be improved more obviously.
>
> 温绍锦 has updated the pull request incrementally with two additional commits since the last revision:
> 
>  - update comments
>  - update comments

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

> 95:      * For values from 0 to 256 return a short encoding a pair of hex ASCII-encoded digit characters in little-endian
> 96:      * @param i value to convert
> 97:      * @param ucase ture uppper case, false lower case

"256" -> "255"
"ture" -> "true"

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15768#discussion_r1330203208


More information about the core-libs-dev mailing list