RE: Referencing Nested Sequences
- Posted by Andy Serpa <ac at onehorseshy.com> Jun 08, 2003
- 477 views
Derek Parnell wrote: > > item > > that is part of a larger item, generally rearrange items in a sequence > > - > where > > each of these items might be a nested sequence. > > > > Would this result in is that large 'copying tasks' for each > > rearrangement > ? - > > Not really. If I understand this ( Robert Craig - can you confirm this?) > correctly, altering an element inside a sequence does not mean that the > entire sequence is copied to a new RAM location. Internally, a sequence > uses > pointers to data, like a handle. This, combined with reference counting > and > garbage collection, means that manipulating a sequence's contents is not > all > that inefficient. > It depends what you're doing. Most sequence operations are fast, but if you take a nested sequence and iteratively grow the inner sequences your program can slow to a crawl (if it is BIG sequence), and you might have to switch to a less intuitive algorithm to get good efficiency. There is "always a way" though, but sometimes you've got rewrite it a few times....