Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!udel!princeton!cs!atomic.Princeton.EDU!nr From: nr@atomic.Princeton.EDU (Norman Ramsey) Newsgroups: comp.lang.modula3 Subject: making pickles smaller Message-ID: <7927@rossignol.Princeton.EDU> Date: 27 Mar 91 16:43:18 GMT Sender: news@cs.Princeton.EDU Organization: Princeton Computer Science Dept Lines: 28 Originator: nr@atomic.Princeton.EDU I have a program that is generating pickles that are too large. I can imagine two strategies for making them smaller: a) increasing sharing b) where sharing is unimportant, using WriteBytesProc and ReadBytesProc As an example of the first stragety, since TEXTs are supposed to be immutable, I would like to store a single REF for both s and t whenever TYPECODE(s)=TYPECODE(TEXT) AND TYPECODE(s)=TYPECODE(TEXT) AND Text.Equal(s,t) I suspect that this change would realize a substantial savings in my particular pickles, but I can't think of any way of using ConvertProcs to implement this strategy using the current Pkl interface. By the time I know I have a TEXT, it's too late to change it. Trying to find all the TEXT-containing REF types might be very painful. I might apply the second strategy to the type REF CHAR, resulting in a savings of four bytes per value pickled. Question 1: are there any general techniques that can be used to increase sharing, so that distinct references that point to isomorphic structures are merged into a single reference? Question 2: how can I dissect a pickle to determine which types are responsible for the most space usage? Are there any tools? -- Norman Ramsey nr@princeton.edu