Slow performance

Chris Muller ma.chris.m at gmail.com
Sat Nov 10 01:24:45 UTC 2007


Hi Todd, MagmaSets are only for very specific purposes, and only after
they absolutely pay for themselves 10X over a regular MagmaCollection.
 You are not there yet.  MagmaSets are twice as slow as a standard
MagmaCollection when adding because they have to check #includes:
before every add.

The MyDatabaseSession subclass seems like an attempt to make the
session itself act as a "bucket" to stuff data into and then retrieve
out of later.  This is not necessary and probably even not very
workable with Magma.

You should make an *object model* with your root object being a true
custom domain object like a "InvestmentPortfolio", not a dumb
collection.  This InvestmentPortfolio may then reference several
MagmaCollections which can serve as your "buckets"..

Regards,
  Chris


On Nov 8, 2007 1:36 AM, Todd Blanchard <tblanchard at mac.com> wrote:
> OK, I'm totally frustrated.  I can't thing one in or out of  this
> database.
>
> I want the root to act like a dictionary - so I set it up like this:
>
> | set |
> set := (MagmaSet  equivalenceAttributes: (Array with: #key)).
> set addIndex: (MaSearchStringIndex attribute: #key).
> MagmaRepositoryController create: 'magma' root: set.
>
> I start the server session on a port and leave it.  In the client I
> subclass MagmaSession to add schema specific methods.  One thing I
> add is this:
>
> MyDatabaseSession>>at: aSymbol ifAbsentPut: aBlock
>
>         | collection assoc |
>         collection := (self root where:[:ea | ea key = aSymbol]).
>         collection isEmpty
>                 ifTrue: [self root add: (assoc := aSymbol->(aBlock value))]
>                 ifFalse: [assoc := collection first].
>         ^assoc value.
>
> This fails on a newly created database because MaCollectionReader
> isEmpty ends up calling sortIndex on a MaQueryTrunk which doesn't
> seem to understand it.
>
> What gives?
>


More information about the Magma mailing list