> Given that I only want to compute the offsets once, an 
> obvious solution 
> would be to construct an Array of String - each element 
> representing a 
> sub-string of the original... but this would double memory use.  What 
> would be the best way to avoid duplicating the character 
> sequences and 
> causing run-time bloat?

I might be wrong - but I'm pretty sure that substrings in ruby are
created with copy-on-write. That is, when you take a substring, a new
block of memory isn't allocated to the new String, it references the
same block of memory as the original string - the allocation of a new
block of memory only occurs when one of the strings is modified.


#####################################################################################
This email has been scanned by MailMarshal, an email content filter.
#####################################################################################