RFR: 8353453: URLDecoder should use HexFormat

Patrick Strawderman duke at openjdk.org
Tue Apr 1 16:56:29 UTC 2025


On Tue, 1 Apr 2025 00:34:46 GMT, Chen Liang <liach at openjdk.org> wrote:

> Is there a particular reason for this change? Like is this a significant performance bottleneck?

I don't know of a particular bottleneck specifically with `Integer.parseInt` in `URLDecoder`, however `URLDecoder#decode` is often there in the hot path for our applications in general; this change was more so motivated by the following:

- `HexFormat` is purpose built for this specific use case, whereas `Integer.parseInt` is generic (obviously).
- `HexFormat.fromHexDigits` uses a look up table and is in general far fewer lines of code.
- `HexFormat` is used throughout the JDK, so I surmised that the potential usage here might have just been missed.

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

PR Comment: https://git.openjdk.org/jdk/pull/24314#issuecomment-2767896209


More information about the net-dev mailing list