RFR: 8377427: Reduce substring allocations in Color.web(String, double)

John Hendrikx jhendrikx at openjdk.org
Tue Feb 10 10:44:43 UTC 2026


On Sun, 8 Feb 2026 04:24:33 GMT, Michael Strauß <mstrauss at openjdk.org> wrote:

> Color.web(string, double) parses a color string by creating substrings of the input. Almost all of these string allocations can be removed, except for an invocation of `Double.parseDouble(String)`, which doesn't have an overload that accepts a sub-range of the input string.

Use of `parseDouble` is questionable anyway (unless input was sanitized first) as it is a Java double parser.  For example, this works:


Color.web("rgba(2, 2, 1, 0.25e2f)")

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

PR Comment: https://git.openjdk.org/jfx/pull/2069#issuecomment-3876803545


More information about the openjfx-dev mailing list