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

Andy Goryachev angorya at openjdk.org
Thu Feb 19 18:57:10 UTC 2026


On Thu, 19 Feb 2026 17:20:14 GMT, Michael Strauß <mstrauss at openjdk.org> wrote:

>> modules/javafx.graphics/src/main/java/com/sun/javafx/css/parser/CssNumberParser.java line 304:
>> 
>>> 302:      * @see <a href="https://arxiv.org/pdf/2101.11408">Number Parsing at a Gigabyte per Second</a>
>>> 303:      */
>>> 304:     private static final long[] T = new long[] {
>> 
>> Warning about a large binary blob of unknown origin in the source.
>> 
>> I suggest we do two things here:
>> 1. add a comment explaining what it is and how it is computed in general terms
>> 2. provide the code that generates it, so it can be reviewed at the source level.  For example, it might be in a form of a unit test which generates the array and compares it to the one here.
>
> I think the comment already explains what it is, including a link to a script that generates it. The script itself is now in the `powersOfFive()` unit test.

you are right.  do you think it would make sense to point to the code (test) that generates the table in the comment?

>> modules/javafx.graphics/src/test/java/test/com/sun/javafx/css/parser/CssNumberParserTest.java line 234:
>> 
>>> 232:             double expected = Double.parseDouble(number);
>>> 233:             double actual = parseDouble(number);
>>> 234:             assertEquals(Double.doubleToRawLongBits(expected), Double.doubleToRawLongBits(actual));
>> 
>> would it be possible in these fuzzing tests (which are great, by the way!) add a check for a few values adjacent to each point (i.e. +1 ulp, +2 ulp, -1 ulp, -2 ulp)?
>
> For what purpose? The numbers are already random, adding or subtracting a bit doesn't change that.

to ensure the behavior of adjacent values, as it is not covered just by the random numbers (what is the probability of selecting two adjacent random values?)

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

PR Review Comment: https://git.openjdk.org/jfx/pull/2069#discussion_r2829603130
PR Review Comment: https://git.openjdk.org/jfx/pull/2069#discussion_r2829593218


More information about the openjfx-dev mailing list