Skip to content
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

JDK-8310502 : Optimization for j.l.Long.fastUUID() #14578

Closed
wants to merge 35 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
1459281
8310502 : optimization for UUID#toString
wenshao Jun 21, 2023
35af153
8310502 : HEX256 initialization use constant values improved jvm startup
wenshao Jun 21, 2023
8bc49c9
8310502 : hex literal
wenshao Jun 21, 2023
a952e10
add annotation Stable
wenshao Jun 21, 2023
c73f7ed
simplify code
wenshao Jun 21, 2023
ad53343
import ByteOrder
wenshao Jun 21, 2023
e0bcf6c
move HEX256 to LongCache
wenshao Jun 22, 2023
2ec33ac
fix compile error
wenshao Jun 22, 2023
a591e31
use single holder class cache HEX256
wenshao Jun 22, 2023
ae5c2e8
fix compile error
wenshao Jun 22, 2023
728dbdd
use ByteArray for COMPACT_STRINGS disable
wenshao Jun 22, 2023
c6dca16
revert to non-ByteArray
wenshao Jun 22, 2023
2c9660a
use ByteArray & simplify code
wenshao Jun 22, 2023
5a5e7e1
use ByteArray.setInt & setLong
wenshao Jun 22, 2023
c11668c
make fastUUID codeSize less than 325 (FreqInlineSize)
wenshao Jun 22, 2023
2b35aa4
add import & rename HEX to H256
wenshao Jun 22, 2023
ff6e7e4
format code
wenshao Jun 22, 2023
27a8212
remove Arrays.fill
wenshao Jun 23, 2023
dce6296
remove unused import
wenshao Jun 23, 2023
0d34655
make Long.fastUUID codeSize less than 325 (FreqInlineSize)
wenshao Jun 23, 2023
f08444f
format code
wenshao Jun 23, 2023
17a9f16
add jdk.util.HexDigits, sharing cache array across multiple classes, …
wenshao Jun 25, 2023
efaa869
move fastUUID implementation to UUID.toString
wenshao Jun 25, 2023
4b5019f
remove JavaLangAccess#fastUUID
wenshao Jun 25, 2023
6b61a71
use ISO_8859_1.INSTANCE directly instead of StandardCharsets.ISO_8859_1
wenshao Jun 26, 2023
9fe1d70
fix UUID.java import, rename jdk.util.HexDigits to jdk.util.Hex256 an…
wenshao Jun 27, 2023
fe9efa6
Update src/java.base/share/classes/jdk/internal/util/Hex256.java
wenshao Jun 27, 2023
b81f12d
change copyright years, and rename jdk.internal.util.Hex256 to jdk.in…
wenshao Jun 27, 2023
4a4c64b
revert to HexDigits.DIGITS, keep this PR as simple as possible.
wenshao Jun 27, 2023
26f3a6a
remove unused import, and fix comment
wenshao Jun 27, 2023
0a7f2cc
revert HexDigits.DIGITS private
wenshao Jun 29, 2023
93e74b6
code format
wenshao Jun 29, 2023
d8ee124
code format & comments add endianness
wenshao Jun 29, 2023
fe144ef
Update full name
wenshao Jun 29, 2023
aea4e04
fix comments typo
wenshao Jun 29, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 6 additions & 16 deletions src/java.base/share/classes/java/lang/Long.java
Original file line number Diff line number Diff line change
@@ -470,26 +470,16 @@ static String fastUUID(long lsb, long msb) {
if (COMPACT_STRINGS) {
byte[] buf = new byte[36];

ByteArray.setChar(buf, 0, i0);
ByteArray.setChar(buf, 2, i1);
ByteArray.setChar(buf, 4, i2);
ByteArray.setChar(buf, 6, i3);
ByteArray.setLong(buf, 0, ((long) i0 << 48) | ((long) i1 << 32) | ((long) i2 << 16) | i3);
buf[8] = '-';
ByteArray.setChar(buf, 9, i4);
ByteArray.setChar(buf, 11, i5);
ByteArray.setInt(buf, 9, (i4 << 16) | i5);
buf[13] = '-';
ByteArray.setChar(buf, 14, i6);
ByteArray.setChar(buf, 16, i7);
ByteArray.setInt(buf, 14, (i6 << 16) | i7);
buf[18] = '-';
ByteArray.setChar(buf, 19, i8);
ByteArray.setChar(buf, 21, i9);
ByteArray.setInt(buf, 19, (i8 << 16) | i9);
buf[23] = '-';
ByteArray.setChar(buf, 24, i10);
ByteArray.setChar(buf, 26, i11);
ByteArray.setChar(buf, 28, i12);
ByteArray.setChar(buf, 30, i13);
ByteArray.setChar(buf, 32, i14);
ByteArray.setChar(buf, 34, i15);
ByteArray.setLong(buf, 24, ((long) i10 << 48) | ((long) i11 << 32) | ((long) i12 << 16) | i13);
ByteArray.setInt(buf, 32, (i14 << 16) | i15);

return new String(buf, LATIN1);
}