On Thu, Jun 2, 2011 at 12:38 PM, Norbert Hartl <norbert@hartl.name> wrote:
Before I start a utility myself I want to ask if there is such a tool already.

I'm using sixx for object graph serialization. It works quite good but it has some severe limits.

I am interesting in listening which ones apart from performance/speed.

Well, the limits are not really sixx dependent but a problem of usual serializers. My problem is the size of the stack such a tool generates.

The stack is a problem???� By stack you mean stack of MethodContexts ?
why do you say a "usual" problem of serializers?� do you mean because of the fact the the graph is usually traversed with a recursion?

Especially in gemstone this appears to be a problem because the stack is limited per gem.


In which sense the stack is limited?
If I look at the serializers I know the mechanics are simple:

1. take an object and look it up in a table.
2. if the object is in the table it has already been serialized. We take a reference from the table and write it down
3. if it isn't in the table it means the object has not been serialized and the contents need to be written. After that the object with a reference representation is written to the table
4. while writing the content of an object (inst vars) I encounter simple objects (direct string representation) or complex objects (composite). In the latter case we start over from 1.

If the object graph is well interconnected than the odds are high that a stack will grow high until the first reference can be written. With a small pier kernel I already matched a stack size of 1000.


In Fuel we� traverse the graph but instead of using a recursion we use our own simple stack implementation where we push and pop objects.
But Martin may explaint better than me.
One solution I can think of is to collect and order objects in the graph that cover smaller segments from the overall graph. This way I would construct a sorted collection that is sorted by stack depth (lowest first). The collection will then be serialized leading to a much smaller possible stack sizes. It might be there are cases it can't work but I think for most cases it will do its job. And it will be slow of course.

Does anybody know if such a tool exists?

Norbert





--
Mariano
http://marianopeck.wordpress.com