I forgot to say something..... notice that using this hook is slower than a plain serialization. So what I mean is that if the strings are not that big, then it may happens that the usage of the hook + the compression is slower than a plain serialization + the regular string. I let you know because you may not expect that. I should benchmark the overhead of the hook....
Cheers On Mon, Oct 10, 2011 at 9:54 PM, Mariano Martinez Peck < [email protected]> wrote: > > > On Mon, Oct 10, 2011 at 9:35 PM, Hernán Morales Durand < > [email protected]> wrote: > >> Is there any serializer (Fuel/StOMP/Ma object >> serialization/BOSS/SRP/SIXX??) which let me attach an external >> compressor/decompressor for specific Strings to the >> serialization/deserialization process? > > > In Fuel you can do: > > String >> fuelSubstitution > ^ ExternalCompressor compress: self > > String >> fuelAccept: aVisitor > ^ (ExternalCompressor shouldCompressString: self) > ifTrue: [aVisitor visitSubstitution: self] > ifFalse: [super fuelAccept: aVisitor] > > But the problem is that if #compress: answers an instance of String, you > should be careful that if #shouldCompressString: asnwers true to the > compressed string, then you will end up in an infinitive loop. > > See: http://rmod.lille.inria.fr/web/pier/software/Fuel/Hooks and > FLHookedSubstitutionTest > > I think StOMP should support this as well: > http://stomp.smalltalk-users.jp/home/how-to-use-stomp/hook-methods > > The previous hook you let you replace the original String with its > compression during serialization. Which make sense because if you are going > to compress it is better to do it during serialization. > > With external I mean it could >> be in a separate binary (I could arrange the binding though). >> > > I am not sure if I understood. > > > > >> Thanks >> >> Hernán >> >> > > > -- > Mariano > http://marianopeck.wordpress.com > > -- Mariano http://marianopeck.wordpress.com
