RFR: 8335802: Improve startup speed HexFormat uses boolean instead of enum [v2]

duke duke at openjdk.org
Fri Jul 12 14:22:52 UTC 2024


On Wed, 10 Jul 2024 22:02:12 GMT, Shaojin Wen <duke at openjdk.org> wrote:

>> The current HexFormat defines an Enum to represent LowerCase and UpperCase
>> 
>> 
>> class HexFormat {
>>     private enum Case {
>>         LOWERCASE,
>>         UPPERCASE
>>     }
>> }
>> 
>> 
>> This will cause the JVM to load one more class when it starts, which can be seen as follows
>> 
>> 
>> public class Startup {
>>     public static void main(String[] args) {}
>> }
>> 
>> 
>> 
>> java -verbose:class Startup
>> 
>> 
>> 
>> [0.094s][info][class,load] java.util.HexFormat$Case source: /Users/.../jdk/modules/java.base
>> 
>> 
>> There are only two cases here, which can be represented by boolean, which is clearer and can improve the startup speed a little bit.
>
> Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision:
> 
>   copyright

@wenshao 
Your change (at version 9b1bf851e614e2f5b1517e1b37b8b4d7203d77d3) is now ready to be sponsored by a Committer.

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

PR Comment: https://git.openjdk.org/jdk/pull/20060#issuecomment-2225687328


More information about the core-libs-dev mailing list