Hi Ulf,
I think it is better to focus on the clean-up for my current
transaction. The performance improvement of toUpper() method can be
another topic for String class.
Thanks,
-Dan
On 10/09/2012 12:31 PM, Ulf Zibis wrote:
Hi,
I did not look into the details, but the hint about performance on
String.toLower in WindowsNTFileSystem catched my attention. Here is a
very fast converter, which may be enough for calculating the hash:
// Private ASCII-only optimized version
public static final String toUpper(final String s) {
boolean allUpper = true;
char[] ca = null;
for (int i=0; i<s.length(); i++) {
int c = s.charAt(i);
if (c >= 'a' && c <= 'z') {
if (allUpper) {
ca = s.toCharArray();
allUpper = false;
}
ca[i] -= '\u0020';
}
}
return allUpper ? s : new String(ca);
}
It also avoids instantiation of new objects, if there is nothing to
change.
Note: the equivalent toLower algorithm statistically would be little
slower on latin characters, but maybe faster on wide spreaded Unicode
characters.
-Ulf
Am 09.10.2012 19:46, schrieb Dan Xu:
Hi folks,
Please help review the code change for CR7186817 to remove Windows
95/98/ME support. The webrev has been uploaded to
http://cr.openjdk.java.net/~dxu/7186817/webrev/
<http://cr.openjdk.java.net/%7Edxu/7186817/webrev/>
The main focus of this clean-up is in IO area. And I also cleaned
java/lang/ProcessImpl_md.c and java/util/TimeZone_md.c in this
transaction.
Thanks,
-Dan