[Pharo-project] Basic tricks for improving a serializer?

Mariano Martinez Peck marianopeck at gmail.com
Tue May 17 15:21:43 CEST 2011


Hi guys. Together with Martin we are developing a fast object graph
serializer called Fuel. The idea is to use a pickle format similar to VW
Parcels. Right now we are able to correctly serialize (almost) all kind of
objects (from different classes and so on). The algorithm is working quite
well and we are already quite fast. We also know how to encode more or less
efficient some of the "primitive" classes like Floats, SmallIntegers,
ByteString, ByteArray, etc, etc.

What we really don't know anything about streams. For example, until now, we
were using just a MultiByteFileStream and doing all the time things like
#next:  #nextPutAll:  #nextWordPut: etc...

Now Igor told us for example, to use a buffer like this:

    | bufferStream |
    bufferStream := ByteArray new writeStream.

    (FLSerializer on: bufferStream)
        serialize: anArrayToSerialize.

    aFileStream nextPutAll: bufferStream contents.

and that it at least 2 times faster than we were doing.... I guess it is
because it goes to the disk only once. But MultiByteFileStream uses a
buffer, doesn't it ?

For reading (deserialization) we are not doing nothing special. We just open
the file stream and we read with #next  #nextString ... etc.

Another thing is which kind of file stream should we use.
MultiByteFileStream ? StandardFileStream ?

So...before spending time in some optimizations, are there "known" things
that  we should check?

Thanks in advance,


-- 
Mariano
http://marianopeck.wordpress.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gforge.inria.fr/pipermail/pharo-project/attachments/20110517/7573b2a3/attachment.htm>


More information about the Pharo-project mailing list