mahout-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Drew Farris <>
Subject Re: Writables and Inheritance
Date Tue, 05 Jan 2010 18:39:07 GMT
On Tue, Jan 5, 2010 at 11:51 AM, Sean Owen <> wrote:

> ... which further leads me to comment that the *best* way of
> approaching all this would be to implement Serializable correctly.
> Then generically create one Writable wrapper that leverages
> Serializable to do its work. Then we have everything implemented
> nicely. You can use Vectors in any context that leverages standard
> serialization -- which is a big deal, for example, in J2EE.
> I stand by that until someone points out why this won't work or is
> slow or something at runtime; don't see it yet.

I've seen that Java's serialization mechanism through
ObjectInput/ObjectOutputStream tends to be slower and more
memory-intensive than hand-rolled serialization with writing to
ByteBuffers or byte[]. A part of that may be just the way the Java
default mechanism handles allocating memory and moving the data
around, but the use of reflection and the verbosity of built-in
serialization are certainly factors.

In one case, hand-rolled serialization resulted in a 10x performance
improvement over ObjectOutput/ObjectInput plumbed into

That doesn't mean one shouldn't attempt to implement Serializable for
convenience. I just wanted to make a point about the runtime


View raw message