How can I speed up serialization?
Tim Rohaly One thing that slows serialization down considerably is the calculation of the serial version unique identifier, or SUID. This value needs to be calculated when an object is written out, becausewhere "nnn" represents a long integer. To ensure backward compatibility with existing serialized objects of that class, you cannot choose an arbitrary long integer here; you must choose the same value that was automatically generated. You can find out what that was by running the Java 2 SDK tool "serialver" on your old class file.
ObjectOutputStreamincludes it in the serialized version of the object. It also needs to be calculated when an object is read in, because
ObjectInputStreamneeds to compare the SUID of the serialized object to the SUID of the class file to ensure version compatibility.
You can turn off this calculation by explicitly defining an SUID in your class. The SUID must be defined as:
private static final long serialVersionUID = nnnL;