Integrated: 8335802: Improve startup speed HexFormat uses boolean instead of enum
Shaojin Wen
duke at openjdk.org
Fri Jul 12 14:38:55 UTC 2024
On Fri, 5 Jul 2024 23:06:17 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.
This pull request has now been integrated.
Changeset: 84c74ad0
Author: Shaojin Wen <shaojin.wensj at alibaba-inc.com>
Committer: Chen Liang <liach at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/84c74ad0a94f5c36529c63d846f15916259ee6a5
Stats: 26 lines in 1 file changed: 1 ins; 6 del; 19 mod
8335802: Improve startup speed HexFormat uses boolean instead of enum
Reviewed-by: liach
-------------
PR: https://git.openjdk.org/jdk/pull/20060
More information about the core-libs-dev
mailing list