java.util.UUID.fromString performance (original) (raw)
Vitaly Davidovich vitalyd at gmail.com
Tue Feb 28 14:26:35 UTC 2012
- Previous message: Reviewer needed: (JDK7) fixed three typos in a class ScriptEngineManager
- Next message: java.util.UUID.fromString performance
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi all,
I noticed that this method could be made a bit more performant by:
creating a statically initialized Pattern for "-" and then calling split() on that. Currently the method calls name.split() which compiles the pattern on each invocation.
use Long.parseLong() instead of Long.decode() to extract the bits.
With these changes, the method runs at least 20% faster (some runs were significantly faster) on an Intel Westmere server and should be a bit more GC friendly.
Any thoughts? I can send the full code a bit later when I'm in front of my computer.
Thanks
Sent from my phone
- Previous message: Reviewer needed: (JDK7) fixed three typos in a class ScriptEngineManager
- Next message: java.util.UUID.fromString performance
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]