Skip to content

8335802: Improve startup speed HexFormat uses boolean instead of enum #20060

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

wenshao
Copy link
Contributor

@wenshao wenshao commented Jul 5, 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.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8335802: Improve startup speed HexFormat uses boolean instead of enum (Enhancement - P4)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/20060/head:pull/20060
$ git checkout pull/20060

Update a local copy of the PR:
$ git checkout pull/20060
$ git pull https://git.openjdk.org/jdk.git pull/20060/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 20060

View PR using the GUI difftool:
$ git pr show -t 20060

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/20060.diff

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jul 5, 2024

👋 Welcome back wenshao! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Jul 5, 2024

@wenshao This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8335802: Improve startup speed HexFormat uses boolean instead of enum

Reviewed-by: liach

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 69 new commits pushed to the master branch:

  • 4f312d6: 8336152: Remove unused forward declaration in classLoadInfo.hpp
  • 34d8562: 8335902: Parallel: Refactor VM_ParallelGCFailedAllocation and VM_ParallelGCSystemGC
  • 2fc7eb4: 8155030: The Menu Mnemonics are always displayed for GTK LAF
  • 559826c: 8332474: Tighten up ToolBox' JavacTask to not silently accept javac crash as a failure
  • eec0e15: 8335619: Add an @APinote to j.l.i.ClassFileTransformer to warn about recursive class loading and ClassCircularityErrors
  • 9b6f6c5: 8336082: Fix -Wzero-as-null-pointer-constant warnings in SimpleCompactHashtable
  • 7a62032: 8336081: Fix -Wzero-as-null-pointer-constant warnings in JVMTypedFlagLimit ctors
  • f677b90: 8267887: RMIConnector_NPETest.java fails after removal of RMI Activation (JDK-8267123)
  • 1fe3ada: 8336284: Test TestClhsdbJstackLock.java/TestJhsdbJstackLock.java fails with -Xcomp after JDK-8335743
  • c703d29: 8335710: serviceability/dcmd/vm/SystemDumpMapTest.java and SystemMapTest.java fail on Linux Alpine after 8322475
  • ... and 59 more: https://git.openjdk.org/jdk/compare/b83766e59063a41ea8801ac9e7c15dce67727c62...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@liach) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk
Copy link

openjdk bot commented Jul 5, 2024

@wenshao The following label will be automatically applied to this pull request:

  • core-libs

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the core-libs core-libs-dev@openjdk.org label Jul 5, 2024
@wenshao wenshao changed the title Improve startup speed HexFormat uses boolean instead of enum 8335802: Improve startup speed HexFormat uses boolean instead of enum Jul 5, 2024
@openjdk openjdk bot added the rfr Pull request is ready for review label Jul 5, 2024
@mlbridge
Copy link

mlbridge bot commented Jul 5, 2024

Webrevs

Copy link
Member

@liach liach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The internal enum representation is an unnecessary abstraction; a boolean for uppercase is used for all public endpoints in isUpperCase and toString, so using the same boolean internally makes sense.

Do you think we should call this field ucase or uppercase?

@wenshao
Copy link
Contributor Author

wenshao commented Jul 10, 2024

The internal enum representation is an unnecessary abstraction; a boolean for uppercase is used for all public endpoints in isUpperCase and toString, so using the same boolean internally makes sense.

Do you think we should call this field ucase or uppercase?

ucase is a name that has been used in this class. It is used in the formatOptDelimiter method. ucase is an abbreviation, but it is easy to understand. Using the name ucase also requires fewer changes than uppercase.

Copy link
Member

@liach liach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the detailed rationale and explanations! Runs fine on CI.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jul 11, 2024
@wenshao
Copy link
Contributor Author

wenshao commented Jul 12, 2024

/integate

@openjdk
Copy link

openjdk bot commented Jul 12, 2024

@wenshao Unknown command integate - for a list of valid commands use /help.

@wenshao
Copy link
Contributor Author

wenshao commented Jul 12, 2024

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Jul 12, 2024
@openjdk
Copy link

openjdk bot commented Jul 12, 2024

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

@liach
Copy link
Member

liach commented Jul 12, 2024

/sponsor

@openjdk
Copy link

openjdk bot commented Jul 12, 2024

Going to push as commit 84c74ad.
Since your change was applied there have been 69 commits pushed to the master branch:

  • 4f312d6: 8336152: Remove unused forward declaration in classLoadInfo.hpp
  • 34d8562: 8335902: Parallel: Refactor VM_ParallelGCFailedAllocation and VM_ParallelGCSystemGC
  • 2fc7eb4: 8155030: The Menu Mnemonics are always displayed for GTK LAF
  • 559826c: 8332474: Tighten up ToolBox' JavacTask to not silently accept javac crash as a failure
  • eec0e15: 8335619: Add an @APinote to j.l.i.ClassFileTransformer to warn about recursive class loading and ClassCircularityErrors
  • 9b6f6c5: 8336082: Fix -Wzero-as-null-pointer-constant warnings in SimpleCompactHashtable
  • 7a62032: 8336081: Fix -Wzero-as-null-pointer-constant warnings in JVMTypedFlagLimit ctors
  • f677b90: 8267887: RMIConnector_NPETest.java fails after removal of RMI Activation (JDK-8267123)
  • 1fe3ada: 8336284: Test TestClhsdbJstackLock.java/TestJhsdbJstackLock.java fails with -Xcomp after JDK-8335743
  • c703d29: 8335710: serviceability/dcmd/vm/SystemDumpMapTest.java and SystemMapTest.java fail on Linux Alpine after 8322475
  • ... and 59 more: https://git.openjdk.org/jdk/compare/b83766e59063a41ea8801ac9e7c15dce67727c62...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Jul 12, 2024
@openjdk openjdk bot closed this Jul 12, 2024
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review sponsor Pull request is ready to be sponsored labels Jul 12, 2024
@openjdk
Copy link

openjdk bot commented Jul 12, 2024

@liach @wenshao Pushed as commit 84c74ad.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core-libs core-libs-dev@openjdk.org integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

2 participants