Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / May 2006

Tip: Looking for answers? Try searching our database.

Externalizable vs. Serializable

Thread view: 
Digital Puer - 13 May 2006 20:42 GMT
I've read that implementing Externalizable provides faster
performance that Serializable, at least according to:

http://www.onjava.com/pub/a/onjava/excerpt/JavaRMI_10/index.html?page=5

>From my understanding, the primary benefit of Externalizable
is that when I write my marshalling methods, I do not have
to marshall the superclasses of my object (which Serializing
does automatically). Is that right?

However, suppose I have a simple class (whose superclass
is Object) and contains only an int, a String, and a byte array.
Since there is no superclass, implementing Externalizable
or Serializable should not make much of a difference in
terms of performance, no? Indeed, my cursory implementation
both ways shows little difference at all (and any differences
are within the boundaries of experimental error).
Stefan Schulz - 13 May 2006 21:22 GMT
That is the catch, why usually Externalizable is not used. If the
superclass is trivial anyway (Object or very similar), Marshalling it
via standard serialization does not add any significant overhead. On
the other hand, if it is non-trivial, it is usually not exactly easy to
serialize by hand, usually forcing you to break member protection by
means of reflection... in which case most of the performance advantage
disappears again.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.