-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8311207: Cleanup for Optimization for UUID.toString #14745
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
Conversation
|
👋 Welcome back wenshao! A progress list of the required criteria for merging this PR into |
Webrevs
|
|
Is using |
Using Unsafe on aliyun_ecs_c8i.xlarge and MacBookPro M1 Pro is faster than ByteArray, and I haven't figured out why |
Suggested HexDigits change
|
|
Can you post the benchmark results? And do you have like a baseline for the benchmarks, as there may be other factors that affect performance from run to run? Also, my fault for actions: can you go to your actions tab and enable actions for your fork like this? |
|
@liach Your version performance is a bit worse, If I can't find the reason, I will revert to the previous version |
|
@liach I guess your version is slower because it doesn't support out-of-order execution. |
Co-authored-by: liach <liach@users.noreply.github.com>
|
/integrate |
|
@wenshao This pull request has not yet been marked as ready for integration. |
|
/sponsor |
|
@wenshao Only Committers are allowed to sponsor changes. |
|
Given the endian-ness issues with https://git.openjdk.org/jdk/pull/14699. |
|
@TheRealMDoerr Can you help me test this PR on AIX (big endian) ? |
|
I have run a couple of tests on linux Big Endian. They have passed. So, it's probably correct. However, I can't tell if it's good to use |
|
@RogerRiggs Can it be merged now? |
|
@TheRealMDoerr An alternative approach tried before is to pack the digits platform-specifically and use Unsafe (which bypasses platform-endianness reversals) to write directly; I recall it was rejected before, for using unsafe directly seems... unsafe :) |
|
I think making sure C2 optimizes it would be a better approach. Java classes shouldn't be optimized for performance on any endianness version IMHO. Rather for readability. |
@TheRealMDoerr Testing on s390 is not possible for now, as build is broken due to field resolution changes. |
# Conflicts: # src/java.base/share/classes/java/util/UUID.java # src/java.base/share/classes/jdk/internal/util/HexDigits.java
| return DIGITS[b0 & 0xff] | ||
| | (DIGITS[b1 & 0xff] << 16) | ||
| | (((long) DIGITS[b2 & 0xff]) << 32) | ||
| | (((long) DIGITS[b3 & 0xff]) << 48); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you reverse the order of these source lines to put the shifts of the higher order bits before the lower order bit shifts. 3333222211110000. Its easier to understand where the bits end up in the long.
The rest of the change is better focused.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if reverse packDigits order, performance will be slow, I don't know why yet.
The following is the data running on MacBookPro M1 Max :
make test TEST="micro:java.util.UUIDBench.toString"
Benchmark (size) Mode Cnt Score Error Units (current order 4f6ed3e6)
UUIDBench.toString 20000 thrpt 15 96.396 ? 0.946 ops/us
Benchmark (size) Mode Cnt Score Error Units (reverse packDigits order)
UUIDBench.toString 20000 thrpt 15 86.496 ? 0.542 ops/us
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like something that might be an interesting puzzler for JIT compiler folks. Perhaps added implicit casts to long messes something up?
|
/integrate |
|
/sponsor |
|
Going to push as commit f8df754.
Your commit was automatically rebased without conflicts. |



PR 14578 still has unresolved discussions, continue to make improvements.
Benchmark Result
1. aliyun_ecs_c8i.xlarge
2. aliyun_ecs_c8a.xlarge
3. aliyun_ecs_c8y.xlarge
4. MacBookPro M1 Pro
5. Orange Pi 5 Plus
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/14745/head:pull/14745$ git checkout pull/14745Update a local copy of the PR:
$ git checkout pull/14745$ git pull https://git.openjdk.org/jdk.git pull/14745/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 14745View PR using the GUI difftool:
$ git pr show -t 14745Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/14745.diff
Webrev
Link to Webrev Comment