Am 02.06.2011 um 15:00 schrieb Igor Stasenko:
Btw, what deserializer does, if it discovers that instance of some class, which you want to bring to life from storage now has its format changed? suppose that when saving graph, some class has inst vars 'a b c' but then you changed the class definition and its inst vars now 'a d e' ?
I think it is not a responsibility of serializer to deal with that (there should be a higher level layer which can handle instance migration), while serializer just reports an error that it can't reify an object because its original class are either gone or changed format.
I think the throwing of an error you need anyway in case something goes wrong. But I would welcome a support in the serializer to plug in a class shape changer. Most of the time I do format changes I know exactly what to convert and so it might be a good option to desribe it together in one object. This object would be different for every oldversion-newversion tuple. In gemstone it is different because there are class versions. Each class can have a migrateTo: method that deals with it. Norbert
On 2 June 2011 14:51, Norbert Hartl <norbert@hartl.name> wrote:
Am 02.06.2011 um 14:31 schrieb Mariano Martinez Peck:
Thanks Norbert. Now I could successfully run benchmarks for SIXX and compare with Fuel. But that's not really fare because we are comparing a text based serializer against a binary one.
It is interesting anyway. I like to know if it is 20 times faster or even more. On the other hand it is not fair either. I don't know fuel but I think it platform dependent, right? So it is not fair the other way round because you compare a cross-platform serializer with a platform-dependent one ;) I think these are the categories that people think about when the are about to choose what util to use. Norbert
Mariano
On Thu, Jun 2, 2011 at 12:14 PM, Norbert Hartl <norbert@hartl.name> wrote:
Am 02.06.2011 um 11:42 schrieb Mariano Martinez Peck:
serialize: anObject on: aStream | sws | sws := SixxWriteStream on: aStream. sws nextPut: anObject. sws close.
serialize: anObject on: aStream anObject sixxOn: aStream
materializeFrom: aStream | srs objects | srs := SixxReadStream on: aStream. objects := srs contents. srs close. ^ objects
materializeFrom: aStream ^ Object readSixxFrom: aStream Norbert
Is that correct or I am doing it wrong? All I want to do is to serialize a graph into a stream.
The stream I am using is or this:
(FileDirectory default forceNewFileNamed: 'Bench')
or
(RWBinaryOrTextStream on: '')
I am not sure if I should be doing a #nextPut: or a #nextPutAll:. I mean, sometimes anObject is a collection and sometimes it is not. So, which one should I use?
Thanks
Mariano
-- Mariano http://marianopeck.wordpress.com
-- Mariano http://marianopeck.wordpress.com
-- Best regards, Igor Stasenko AKA sig.