[comp.lang.modula3] making pickles smaller

nr@atomic.Princeton.EDU (Norman Ramsey) (03/28/91)

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