• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Serialization Vs Externalisation

 
Ranch Hand
Posts: 527
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

How does the performance effect on Externalisation over Serialization.
 
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Author
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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/
 
reply
    Bookmark Topic Watch Topic
  • New Topic