RFR: 8316426: Optimization for HexFormat.formatHex
温绍锦
duke at openjdk.org
Tue Sep 19 05:00:40 UTC 2023
On Mon, 18 Sep 2023 17:18:29 GMT, Roger Riggs <rriggs at openjdk.org> wrote:
> > HexDecimal#DIGITS is a table with a size of 512 bytes. I think that in such a table, when it needs to be used continuously, it is worthwhile to perform table lookup operations.
>
> HexFormat was designed for presenting bytes to humans, typical line lengths for the useful output are 80-130 characters, so input sizes of 40-65 bytes, probably less when other interpretations (such as latin1 or ascii) are appended. And the output is not typically performance sensitive. Please keep the code small and easy to maintain.
If the input is byte[], there may be performance requirements. Other scenarios, such as toHexDigits, may not be performance sensitive. For code consistency, HexDigits.digitPair should be used by all methods of HexFormat.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/15768#issuecomment-1724831658
More information about the core-libs-dev
mailing list