RFR: 8361213: J2DAnalyzer should emit the score as a decimal

Jonas Norlinder duke at openjdk.org
Wed Jul 2 16:13:39 UTC 2025


On Wed, 2 Jul 2025 14:46:45 GMT, Eric Caspole <ecaspole at openjdk.org> wrote:

>> src/demo/share/java2d/J2DBench/src/j2dbench/report/J2DAnalyzer.java line 273:
>> 
>>> 271:                 double overallscore = totalscore[i]/numtests[i];
>>> 272:                 System.out.println("    Number of tests:  "+numtests[i]);
>>> 273:                 System.out.printf("    Overall average:  %10.4f%n", overallscore);
>> 
>> double overallscore = 2.4322;
>>         System.out.println("    Overall average:  "+overallscore); // before
>>         System.out.printf("    Overall average:  %10.4f%n", overallscore); // after
>> 
>> 
>> leads to
>> 
>>     Overall average:  2.4322 // before
>>     Overall average:      2.4322 // after
>> 
>> 
>> should it be a fixed 10 width here?
>
> I am not sure what you mean, but with the 10, the scores line up with the rest of the minor stats when it is monospace font like this example -
> 
> 
> Summary:
>   vimg_text_noaa: 
>     Number of tests:  2
>     Overall average:  20002.7449
>     Best spread:      1.3% variance
>     Worst spread:     3.62% variance
>     (Basis for results comparison)

Thanks. I was thinking if the difference between the old and new behavior would result in any rendering differences. The example you showed is a special case where the amount of characters is => 10.

If `overallscore` is say `1.678` then it renders like this:

`System.out.printf("    Overall average:  %10.4f%n", overallscore);`

Summary:
  vimg_text_noaa_1: 
    Number of tests:  2
    Overall average:      1,6780
    Best spread:      2.14% variance
    Worst spread:     2.57% variance
    (Basis for results comparison)

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26076#discussion_r2180458288


More information about the client-libs-dev mailing list