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
Removed instances of String.format to help funcotator performance #7370
Conversation
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 great - just a couple minor things.
@@ -13,6 +13,7 @@ | |||
import java.util.LinkedHashSet; | |||
import java.util.List; | |||
import java.util.stream.Collectors; | |||
import org.apache.commons.lang3.StringUtils; |
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 this import was added but isn't needed. Can you remove it?
.collect(Collectors.toList()); | ||
final List<String> cleanLetters = new ArrayList<>(); | ||
for(String s: badLetters) { | ||
String hex = Integer.toHexString(s.getBytes(StandardCharsets.US_ASCII)[0] & 0xFF).toUpperCase(); |
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.
This is great, but I think you can simplify it into an if statement with one assignment in each branch:
if (s.getBytes(StandardCharsets.US_ASCII)[0] < 16) {
// Need to add leading zero
}
else {
// straight conversion
}
Then you can do one assignment (with a couple of +
operations) in each of those conditions.
resolves #6574