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

Shaojin Wen duke at openjdk.org
Wed Jul 10 22:02:12 UTC 2024


> 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

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/20060/files
  - new: https://git.openjdk.org/jdk/pull/20060/files/bf8d7cb4..9b1bf851

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=20060&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=20060&range=00-01

  Stats: 2 lines in 1 file changed: 1 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/20060.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/20060/head:pull/20060

PR: https://git.openjdk.org/jdk/pull/20060


More information about the core-libs-dev mailing list