MagmaCollectionReader>>size takea a long time

Chris Muller asqueaker at gmail.com
Sat Sep 1 01:43:18 UTC 2007


Juan, please the section "Optimizing Performance" in the documentation
about querying MagmaCollections to understand when #size will be very
fast vs. pretty slow.

 http://wiki.squeak.org/squeak/5859

For the cases that are "pretty slow" (i.e., a Reader requiring
distinct results), note you have #lastKnownSize, which is the cached
size (therefore instant access).

 - Chris

On 8/31/07, Burella Juan M. <juan.burella at gmail.com> wrote:
> Thanks Igor for your answer.
>
> If calculating a MagmaCollectionReader size is costly, then why not forward
> #size to its MagmaCollection?
> My problem is I'm sending #size to a MagmaCollectionReader because I need to
> paginate the collection for showing its contents in the UI. Any suggestions?
>
> Thanks
> Juan M.
>
> On 8/31/07, Igor Stasenko <siguctua at gmail.com> wrote:
> > use collection.
> > a #size for MagmaCollectionReader is not something which can be fast,
> > because collectionreader designed for reading/filtering collections
> > with provided filter query. It's impossible to determine the number of
> > items in filtered collection in other way than reading and testing
> > full collection, thats why #size is bad practice for using with
> > collectionreader. It designed for sequential reading, not for random
> > access.
> >
> >
> >
> > On 31/08/2007, Burella Juan M. <juan.burella at gmail.com> wrote:
> > > Hi list,
> > >
> > >       I have a indexed MagmaCollection ( it has about 11,000 objects). I
> > > have noticed that requesting the size to a MagmaCollectionReader takes a
> > > long time whereas the same requesting to a MagmaCollection doesn´t
> > >
> > >  For example:
> > >
> > > "MagmaCollection>>size - fiirst evaluation"
> > > [ (magmaSession root at: #Serial) size ] timeToRun  "answer about 525
> > > milliseconds"
> > > "Note: magmaSession root at: #Serial answer a MagmaCollection"
> > >
> > >
> > > "second evaluation"
> > > [ (magmaSession root at: #Serial) size ] timeToRun  "answer about
> > > 1milliseconds"
> > >
> > > "MagmaCollectionReader>>size  first evaluation"
> > > [ ((magmaSession root at: #Serial) read: #issnString) size ] timeToRun
> > > "answer about 9798 milliseconds"
> > >
> > > "second evaluation"
> > > [ ((magmaSession root at: #Serial) read: #issnString) size ] timeToRun
> > > "answer about  8992 milliseconds"
> > >
> > > Any suggestions for reducing this time?
> > >
> > > Thanks in advance.
> > > Juan Matias.
> > >
> > > _______________________________________________
> > > Magma mailing list
> > > Magma at lists.squeakfoundation.org
> > >
> http://lists.squeakfoundation.org/mailman/listinfo/magma
> > >
> > >
> >
> >
> > --
> > Best regards,
> > Igor Stasenko AKA sig.
> >
>
>
> _______________________________________________
> Magma mailing list
> Magma at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/magma
>
>


More information about the Magma mailing list