MagmaCollection

Chris Muller asqueaker at gmail.com
Tue Sep 15 04:13:21 UTC 2009


Hi Ross,

> Does MagmaCollection preserve order, so that standard collection methods
> will always go through objects in the order of original insertion?

No.  The order of enumeration in a MagmaCollection is based on the age
of the objects; e.g., the order they were ever persisted in the db
(whether part of that MagmaCollection or not).

> While doing some tests for that I ran into "Instances of MagmaCollection
> are not indexable" while using at:

Yep.  They are not indexable.

> I was expecting at: to work since http://wiki.squeak.org/squeak/2639
> says that MagmaCollection "Provides size and absolute position access
> (at: anInteger) making it suitable for scrolling lists".

It does.  What you want to do is described starting under the "Indexes" section.

> Finally, is it advisable to use the standard collection methods if the
> MagmaCollection is large, or is it better to use a reader?

A Reader.  A Reader utilizes the indexing to quickly chop a
MagmaCollection down into a subset accessible by #at:.  Only from
there, and only if absolutely necessary, would you use the standard
collectoin methods.

>  By "better"
> I am mostly thinking of whether the entire collection is forced into
> memory or not.

Don't use the standard Collection api on a large MagmaCollection
except for a batch operation.  For on-line operation, just on a
MagmaCollectionReader which was obtained from sending a constricting
#where: query.

 - Chris


More information about the Magma mailing list