This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Performance and the fly likes Serialization Vs Externalisation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Performance
Bookmark "Serialization Vs Externalisation" Watch "Serialization Vs Externalisation" New topic
Author

Serialization Vs Externalisation

Anil Vupputuri
Ranch Hand

Joined: Oct 31, 2000
Posts: 527

How does the performance effect on Externalisation over Serialization.


SCJP 1.5, SCEA, ICED (287,484,486)
Ajith Kallambella
Sheriff

Joined: Mar 17, 2000
Posts: 5782
Externalization allows you to customize how serialization is done. By implementing externalization you are controlling what gets serialized ( and what doesnot ) as versus default serialization where all non-transient attributes get serialized.
For "fat data" classes with a large number of attributes only a few of which needs to persisted, externalization will help you reduce the size of serialized stream and the time taken to serialize the object. But there will be an overhead involved because the runtime has to call your methods to read/write objects.
This is all I can think of, nothing else comes to my mind in terms of performance benefits. Anyone??

------------------
Ajith Kallambella M.
Sun Certified Programmer for the Java2 Platform.


Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).
Kartik Shah
Ranch Hand

Joined: Dec 07, 2000
Posts: 102
1. Further more if you are subclassing your externalizable class you will want to invoke your superclass's implementation. So this causes overhead while you subclass your externalizable class.
2. methods in externalizable interface are public. So any malicious program can invoke which results into lossing the prior serialized state.


Kartik Shah
SCJP, SCDJWS, IBM Certified Websphere & XML, PMP & Six Sigma - http://blog.kartikshah.info
Jack Shirazi
Author
Ranch Hand

Joined: Oct 26, 2000
Posts: 96
Ajith wrote:
"But there will be an overhead involved because the runtime has to call your methods to read/write objects."
Serialization has huge overheads in having to paw through private stuff via the JVM that is normally unavailable, and also with all the reflection it uses. Externalization is a simple method call.
There is no overhead to the calls to your methods, it normally works out faster. Perverse, but true.
--Jack http://www.JavaPerformanceTuning.com/
 
 
subject: Serialization Vs Externalisation
 
Similar Threads
I/O
String externalisation problem-using NLS and message.properties
externalisation of the jsp's
deserialization constructor execution doubt.
writing hashtable to a file