-
Notifications
You must be signed in to change notification settings - Fork 5.8k
8263677: Improve Character.isLowerCase/isUpperCase lookups #3028
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 redestad! A progress list of the required criteria for merging this PR into |
Baseline:
Patch:
|
Webrevs
|
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 good from build point of view. I like the code cleanups.
@cl4es 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:
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 22 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 integrate this PR with the above commit message to the |
@@ -314,7 +307,7 @@ static void FAIL(String s) { | |||
static long[] buildMap(UnicodeSpec[] data, SpecialCaseMap[] specialMaps, PropList propList) | |||
{ | |||
long[] result; | |||
if (bLatin1 == true) { | |||
if (bLatin1) { |
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.
perhaps shorten to:
final long[] result = new long[bLatin1 ? 256 : 1 << 16];
for (int k = 0; k < m; k++) { | ||
buffer[ptr+k] = map[i+k]; | ||
} | ||
if (m >= 0) System.arraycopy(map, i, buffer, ptr, m); |
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 m == 0, you could skip the arraycopy.
for (int j = 0; j < ptr; j++) { | ||
newdata[j] = buffer[j]; | ||
} | ||
if (ptr >= 0) System.arraycopy(buffer, 0, newdata, 0, ptr); |
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.
ditto, if ptr == 0, skip the arraycopy
for (int j=0; j<args.length; ++j) { | ||
desc.append(" " + args[j]); | ||
for (String arg : args) { | ||
desc.append(" " + arg); |
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.
Avoid string concat:
desc.append(' ').append(arg);
/integrate |
@cl4es Since your change was applied there have been 23 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit e152cc0. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
This patch changes the otherLowercase / otherUppercase bits to be set if either the codepoint is of type LOWERCASE_LETTER and UPPERCASE_LETTER, or the Unicode Other_Lowercase / Other_Uppercase property is set. This simplifies the lookup in Character.isLowerCase/isUpperCase to a single table lookup, which appears to be healthy for performance.
I also took the opportunity to clean up the somewhat dated GenerateCharacter utility class.
Testing: tier1-3
Progress
Issue
Reviewers
Download
To checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/3028/head:pull/3028
$ git checkout pull/3028
To update a local copy of the PR:
$ git checkout pull/3028
$ git pull https://git.openjdk.java.net/jdk pull/3028/head