Estimate serialization size of objects?

Posted by Stefan K. on Stack Overflow See other posts from Stack Overflow or by Stefan K.
Published on 2010-06-18T10:57:02Z Indexed on 2010/06/18 11:13 UTC
Read the original article Hit count: 345

Filed under:
|
|

In my thesis, I woud like to enhance messaging in a cluster.

It's important to log runtime information about how big a message is (should I prefer processing local or remote).

I could just find frameoworks about estimating the object memory size based on java instrumentation. I've tested classmexer, which didn't come close to the serialization size and sourceforge SizeOf.

In a small testcase, SizeOf was around 10% wrong and 10x faster than serialization. (Still transient breaks the estimation completely and since e.g. ArrayList is transient but is serialized as an Array, it's not easy to patch SizeOf. But I could live with that)

On the other hand, 10x faster with 10% error doesn't seem very good. Any ideas how I could do better?

© Stack Overflow or respective owner

Related posts about java

Related posts about serialization