Magma object serializer

Mariano Martinez Peck marianopeck at gmail.com
Fri Jun 3 07:51:00 UTC 2011


On Fri, Jun 3, 2011 at 3:23 AM, Chris Muller <asqueaker at gmail.com> wrote:

> Hi Martin and Mariano, thanks for asking.  The answer depends on what
> you want to measure.  Benchmarking software as complex as a serializer
> is tricky because, as you know, there are multiple functions to
> measure which are used independently in various real-world use-cases.
>
>
Yes, exactly.


> To gain a meaningful understanding of the performance, you need to
> bench the most-atomic level of operations a user of a serializer would
> use individually.
>
>  - Instantiatation / initialization of a MaObjectSerializer.
>  - Serialization of object graphs of various sizes.
>

If you have by chance some code snippets to generate graphs for testing
(maybe you have that in Magma) let us know :)
We can a pice of code that generates binary trees...


>  - Materialization of said graphs.
>  - Also, if doing comparisons to other serializers (which, I'm
> guessing you are) it is crucial to ensure each serializer is
> configured to serialize the same number of objects (i.e., the same
> depth, etc.) as the other serializers being compared to.
>  - It's also important to discover whether any special
> configuration-options / preferences which affect the performance can
> be used.
>

yes, exactly. This is the most complicated when you do not know that much
the serializer. That's why we were asking :)


>
> So, given the one example object you've provided, here are some
> starter scripts which could be used for benching useful serialization
> operations with MaObjectSerializer.
>
> "Initialization"
> [ MaObjectSerializer new ] bench.
>
> "Serialization"
> | obj ser |
> obj := Array with: 1 with: 'string'.
> ser := MaObjectSerializer new.
> [ ser serializeGraph: obj ] bench
>
>
With the rest of the serializers that we do is to serialize the graph into a
file. How could we do this with Magma Serializer?
because serializeGraph: answers a MaSerializedGraphBuffer. So, I guess I can
ask the byteArray to it and do a nextPutAll: or something like that to our
stream?
We also have in Fuel what we call "in memory serialization" that basically
returns the byteArray and then we can materialize from that. So this case
would be similar to this usage of Magma, wouldn't it ?




> "Materialization"
> | obj ser ba |
> obj := Array with: 1 with: 'string'.
> ser := MaObjectSerializer new.
> ba := (ser serializeGraph: obj) byteArray.
> [ ser materializeGraph: ba ] bench
>


The same question of serializtion.



>
> I have not researched any speed optimizations of MaObjectSerializer in
> many years, so I'm sure it will not be as fast as Fuel if it was
> designed for speed from the ground up.  I need to profile and revisit
> performance aspects of MaObjectSerializer.
>

No problem. Speed is only one more measure and only needed in certain
scenarios. And usually speed comes together with trade-offs. In addition,
you cannot compare a serializer of a database to a general-purpose
serializer. Even if magma serializr could be used outside magma. There are a
lot of things that Magma Serializer has to do that maybe other do not need,
or things you cannot do because of magma. So, each serializer has its own
goals.


>
> As I said, benching is tricky, and publishing comparisons even
> trickier


yes, exactly. The problem is in addition that there are supported features
of a serializer that inpacts on the results of a benchmark. For example,
supported class reshapes, initialization after materialization, support
transient instVars...etc... to support all those things you usually spend
more time. So maybe you support all that and in the results you are slower
in comparisson with someone that do not support that. So yes, measuring
speed only is not good. But taking into account the rest of the properties
is better.



> , and so I do appreciate your asking for my input and hope
> whatever you publish to the world will be based on fair, responsible
> measuring.  Toward that end, I support you and thank you for your work
> on Fuel.
>
>
Thanks Chris.



> Regards,
>  Chris
>
>
>
> On Thu, Jun 2, 2011 at 12:14 AM, Martin Dias <tinchodias at gmail.com> wrote:
> > Hi,
> >
> > I want to run some benchmarks with the Magma object serializer... Am I
> using
> > it in the right way?
> >
> > Thanks!!
> > Martin
> >
> >
> >     | serializer graphBuffer anObject classDefinitionsByteArray
> > graphBufferByteArray loadedObject |
> >
> >     anObject := Array with: 1 with: 'string'.
> >
> >     serializer := MaObjectSerializer new.
> >     graphBuffer := serializer serializeGraph: anObject.
> >
> >     classDefinitionsByteArray := serializer classDefinitionsByteArray.
> >     graphBufferByteArray := graphBuffer byteArray.
> >
> >     "put these two bytearrays into a stream, and reload them..."
> >
> >     loadedObject := MaObjectSerializer new
> >         classDefinitionsByteArray: classDefinitionsByteArray;
> >         materializeGraph: graphBufferByteArray
> >
> > _______________________________________________
> > Magma mailing list
> > Magma at lists.squeakfoundation.org
> > http://lists.squeakfoundation.org/mailman/listinfo/magma
> >
> >
>



-- 
Mariano
http://marianopeck.wordpress.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/magma/attachments/20110603/e799f1a5/attachment.htm


More information about the Magma mailing list