RFR: patch to reduce use of many temporary objects in java.util.UUID

Steven Schlansker stevenschlansker at gmail.com
Mon Nov 11 18:39:38 UTC 2013

On Nov 6, 2013, at 4:19 PM, Robert Stupp <snazy at gmx.de> wrote:

> Hi,
> the current implementation of java.util.UUID.fromName() and java.util.UUID.toString() unnecessarily produce a lot of temporary objects. Especially the fromName() method creates some instances of java.lang.Long and indirectly via "name.split()" many Strings, an ArrayList, etc. UUID.toString() creates at least 10 String objects plus the implicitly created char[] instances.
> Here's a hg diff which reduces the temporary object count while still providing the same functionality.

Hi Robert,

I identified the same problem and submitted a patch earlier this year:

Sorry I don’t have the best list message references here, Oracle seems to have decided to break all the links through the old Sun bug database, so all my references are gone.  Bummer. :(

It’s currently living at CR 8006627 and CR 8007398, although I’m having real trouble finding a public link to the bugs.

Last I heard, Mike (CCed) has this in a patch queue somewhere waiting to commit it.  Maybe he will take the good parts from my patch and the good parts from your patch and make an even better patch :)

Steven Schlansker

More information about the core-libs-dev mailing list