[Coco] Strings in DECB

Johann Klasek johann+coco at klasek.at
Thu Oct 22 04:51:19 EDT 2015


On Tue, Oct 20, 2015 at 10:05:14PM -0600, William Astle wrote:
[..]
> There are some other wrinkles with how string space is used:
[..]
> - string space is not actually freed until a new allocation fails. At 
> that time, the entire set of active strings is scanned and the data 
> compacted to consolidate any free space into one lump and only then does 
> the allocation fail if there isn't enough space. This is the garbage 
> collection process and it can cause some substantial slowdowns when 
> string space is tight. That's why it's often good to have a much larger 
> string space than strictly needed for programs that do a lot of string 
> manipulation.

This slowdown depends the count of active (non-empty) strings. The
runtime increases quadratic with the active string count.

If you have many strings the rule is to have more free space especially
to stretch the time interval the GC occurs (assuming a given rate of
string manipulations). There is no way to prevent the GC, except no
string manipulation is done at all.

On a Dragon 32 with ECB 1.0 and 3831 strings the collection takes over
17 minutes (just for comparision, a C64 with a similar speeded 6510 CPU
with the same GC implementation needs nearly 24 minutes - in addition,
the ease and power of 6809 programming is shown by the fact the routine
is less than the half sized comparing to the 6502 implementation ;) ).


Johann



More information about the Coco mailing list