Am 23.07.2013 um 14:23 schrieb "jtuc...@objektfabrik.de" <jtuc...@objektfabrik.de>:
> Norbert, > > Am 23.07.13 14:07, schrieb Norbert Hartl: >> Joachim, >> >> I'm aware that you can do serialization/deserialization yourself. I was >> asking for something to help along the way because a have quite some model >> classes to cover. I want a more generalized way of doing it. As often I >> really think about things _after_ I've sent the mail :) > > We seem to have a lot in common here. Regard it this way: sending the mail > made you think again. So the mail itself was all but useless. >> I think I have to options: >> >> 1. The most generic one is serializing into Fuel and compile the ByteArray >> in a method. >> 2. The most readable one will be using STON and compiling the STON string >> into a method >> >> Maybe I should try both. > I'd be very interested in what you find. I guess Fuel is smaller and maybe > even faster. STON, OTOH, is much friendlier for comparing versions and such. > Well, I can't look at the method but I don't find ByteArrays not that interesting anyway. So the actual size of the serialized byte array is (ByteArray streamContents: [:stream| FLSerializer serialize: TCAP current model on: stream ]) size is 237445 Bytes. Serializing [ MAPExampleModels class compile: 'tcap ^ ', (ByteArray streamContents: [:stream| FLSerializer serialize: TCAP current model on: stream ]) storeString ] timeToRun took 647 ms but [FLMaterializer materializeFromByteArray: MAPExampleModels tcap] timeToRun took only 30ms. Basically I'm not fond of putting too much binary stuff into compiled methods but it is the most easy and reliable way of providing tests with test data. The whole grammar is stored in methods as well. It is text but…. I think I stay with it for a while. Norbert