Cloneable versus Serializable

Posted on 2009-02-20
Last Modified: 2012-05-06
Could someone suggest that how much the performance will be impacted if Serializable interface is used to clone java objects.  org.apache.commons.lang.SerializationUtils provides a method clone() to clone any serializable object but it says its slower.  Any other alternative of cloning?  Not sure if there is any benchmark tool available for this?
Question by:fix2009
    LVL 23

    Expert Comment

    I would think clone to be faster than serialzable, as serilazation has
    to walk through the object graph to store the state of the object. While
    in cloning, the user can simply call other construtor to create a new

    Author Comment

    So is there any other alternative of cloning an object other than clone() method?  I am actually looking for if I dont have to maintain clone method when new properties are added to the object.
    LVL 23

    Accepted Solution

    I am not sure what you mean by alternative to cloning. But there are
    other libraries like xstream, which also does serialization, and pretty
    fast too

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Suggested Solutions

    This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
    A short article about a problem I had getting the GPS LocationListener working.
    The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
    The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now