RFR (S) CR 8006627/8007398: Improve performance of Long.toUnsignedString0, Integer.toUnsignedString0, UUID(String) and UUID.toString

Mike Duigou mike.duigou at oracle.com
Wed Feb 13 01:34:33 UTC 2013

Thank you for the comments Ulf.

On Feb 12 2013, at 17:24 , Ulf Zibis wrote:

> Am 13.02.2013 00:30, schrieb Mike Duigou:
>> Hi Steven;
>> I have updated the patch for Java 8. There's somewhat less code sharing and a bit of refactoring than your last version but the performance should be about the same or a little better.
>> http://cr.openjdk.java.net/~mduigou/JDK-8007398/0/webrev/
> Couldn't you use String(buf, true) for all to(Unsigned)String(...) methods ?

Possibly. I didn't go looking too far with looking for additional improvements.

> Instead of calculating the mask each time, you could use:
> 309     private static String toUnsignedString(int i, int shift, int mask) {

I think that would actually be inefficient. I haven't looked at the JITed code but the mask calculation is pretty cheap relative to parameter passing.

> Additionally in e.g. Integer.toString(int i, int radix) you could provide the fast version with:

I think the only change I will make is to Integer.toUnsignedString() which becomes :
	return Long.toUnsignedString(toUnsignedLong(i), radix);


More information about the core-libs-dev mailing list