RFR 8251989: Hex encoder and decoder utility
Roger.Riggs at oracle.com
Tue Aug 25 14:26:02 UTC 2020
If there's a performance issue, that's an option.
Though its tempting to add intrinsics for each supported instruction
set, it adds code
that has to be maintained forever, so it best to wait till its
determined to be a bottleneck.
Most of the cases I've seen in the code are fairly small, and in
non-performance critical data paths,
for example, the toString method of a certificate.
On 8/24/20 5:11 PM, Corey Ashford wrote:
> Just as a general comment, an SIMD-based encode() intrinsic would be
> an easy performance upgrade for this Hex class. I'd guess you'd get a
> 5x-10x improvement, depending on the specific CPU/arch being used.
> That said, the intrinsic would do better on larger buffers, and I
> don't know what the average length is for the use cases you have in mind.
> - Corey
> On 8/19/20 2:14 PM, Roger Riggs wrote:
>> Please review a java.util.Hex API to encode and decode hexadecimal
>> strings to and from byte arrays.
>> Within the JDK and JDK tests there are multiple implementations to
>> encode and decode
>> hexadecimal strings to byte arrays. Hex encoders and decoders support
>> upper or lower case hexadecimal characters, delimiters, prefix, and
>> The API is modeled after the java.util.Base64 API providing static
>> immutable threadsafe instances with methods to encode to and decode from
>> string and StringBuilder.
>> Webrev for Hex encoder and decoder:
>> Webrev for applying to java.security:
>> Issue for API and a few uses:
>> Issue for Use in java.security and tests:
More information about the core-libs-dev