[comp.sys.mac.hypercard] compression makes stack bigger!

luke@citycs.UUCP (Luke Whitaker) (03/07/89)

I have a problem with a stack I am creating. The size of the stack is very 
critical as it must fit on a standard floppy together with several other
stacks. The stack has one background and about thirteen bg fields. No cards
have any graphics, card fields, or card buttons.

When the stack is empty (ie one card, nothing in any of the fields) its size is
13k. I am loading the data in from a text file whose size is 221k. When the
data is loaded into hypercard, stack size becomes 353k (this is with 1038 cards,
9k free space).

However, when I compress the stack, it gets bigger! (377k, 0k free).
The stack also grows slightly from the 353k minimum when browsing.

I have two questions.

1) Why should a stack get bigger when I compress it?

2) Even on the original minimum size, why is there such a large overhead in
loading the data into the stack (eg 13k empty stack + 221k data = 353k stack,
that's a 119k overhead on 221k of data). Can I do anything to reduce that?

Sorry if this has been dealt with. If so please mail me replies and I will 
summarise.

Thanks very much,

Luke Whitaker, Computer Science, City University, London, EC1V OHB, England.
JANET:	l.whitaker@uk.ac.city.cs	BITNET:	l.whitaker%uk.ac.city.cs@ac.uk
ARPA:	l.whitaker@cs.city.ac.uk (or l.whitaker%uk.ac.city.cs@nss.cs.ucl.ac.uk)
Uucp:	...!ukc!citycs!luke	 (or luke@citycs.uucp)

dan@Apple.COM (Dan Allen) (03/14/89)

In article <48@citycs.UUCP> luke@citycs.UUCP (Luke Whitaker) writes:
>1) Why should a stack get bigger when I compress it?
>
>2) Even on the original minimum size, why is there such a large overhead in
>loading the data into the stack (eg 13k empty stack + 221k data = 353k stack,
>that's a 119k overhead on 221k of data). Can I do anything to reduce that?

Stacks get bigger when compressed only after importing lots of
information.  Why?  HyperCard creates special information when text is
entered that allows FIND to work so fast.  It must create more (i.e.,
larger) information when the stack size gets bigger.  It does this at
Compact Stack time.  So in your case, you started with an empty stack,
imported a bunch of text (with small hint info), did a Compact Stack
(which grew the hints because now you have 100s of cards), and the stack
is bigger.  So, in this particular instance, Compact Stack grows the
stack size, but it makes find much faster.

As for question #2, if each piece of information is brought in and
appended to the end of the stack, this extra slop should not be present.
However, if after bringing in a card's worth of text you then move it to
the front of the stack or something like that, you will leave wholes
that are not coelesced until Compact Stack.

Dan Allen
Apple Computer