Newsletter sign-up
View all newsletters

Enterprise Java Newsletter
Stay up to date on the latest tutorials and Java community news posted on JavaWorld

Sponsored Links

Optimize with a SATA RAID Storage Solution
Range of capacities as low as $1250 per TB. Ideal if you currently rely on servers/disks/JBODs

Into the mist of serialization myths

Performance myth: serialVersionUID improves Java serialization performance

  • Print
  • Feedback

Page 3 of 3

Out of curiosity, I instrumented the java.io.ObjectStreamClass just to see how much time that initial SUID computation takes: this cost turned out to range from 5 to 50 milliseconds in my experiments. This is not a trivial amount to try to save in general, but again, if this is your application's bottleneck, then something is very wrong with your overall design.

The old adage is still true

As it has been said time and time again, you should always profile your application first and optimize the actual hot spots found. Explicitly versioning a class via serialVersionUID requires more code maintenance and is more error prone. There are many valid reasons for using serialVersionUID (protecting against compiler differences, establishing backward serialization compatibility, etc.), but performance is not one of them.

About the author

Vladimir Roubtsov has programmed in a variety of languages for more than 13 years, including Java since 1995. Currently, he develops enterprise software as a senior engineer for Trilogy in Austin, Texas.
  • Print
  • Feedback

Archived Discussions (Read only)
Subject
. Forum migration complete By AthenAdministrator
. Forum migration update By AthenAdministrator
. Uniqueness By Anonymous
Resources