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
8276904: Optional.toString() is unnecessarily expensive #6337
Conversation
|
@eamonnmcmanus The following label will be automatically applied to this pull request:
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. |
Mailing list message from Brian Goetz on core-libs-dev: I would suggest that we hold this patch until the string interpolation On 11/10/2021 1:04 PM, Eamonn McManus wrote: |
I talked to Brian about this a bit. Changing I note that some Amazon folks had filed JDK-8275190 for what is essentially the same issue. (I closed it as a dupe.) They did include some performance numbers, but not the actual code they measured, so without guessing it's hard to say what they actually measured. Could you run some numbers and post them, and can you share some estimates of the impact it might have on your systems? The reason I'm interested in some data here is that this sort of change is worth doing only if it has a real, measurable impact. In turn that implies that you're probably using |
Looks ok on the face of it. I would be useful to see the performance of the improvement. |
Google has profiling in place on its major Java server processes. We observe that, across all profiled If the embedded object has a cheap As a separate but larger project, I think it would be worth investigating whether |
@eamonnmcmanus This change now passes all automated pre-integration checks. After integration, the commit message for the final commit will be:
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 401 new commits pushed to the
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.
|
To reiterate what I said previously, I think these changes are OK because they're the simplest possible case for string concatenation vs. formatting, and therefore the future templating stuff is unlikely to help much; and this has been observed at least twice as the cause of noticeable performance issues (by Google and Amazon). There are a variety of things that could be done in general to speed up formatting. One is straight-up optimization of |
/integrate |
Going to push as commit fe2ae8e.
Your commit was automatically rebased without conflicts. |
@eamonnmcmanus Pushed as commit fe2ae8e. |
Use string concatenation instead of
String.format
.Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/6337/head:pull/6337
$ git checkout pull/6337
Update a local copy of the PR:
$ git checkout pull/6337
$ git pull https://git.openjdk.java.net/jdk pull/6337/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 6337
View PR using the GUI difftool:
$ git pr show -t 6337
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/6337.diff