Chris thanks for your answers. Yes, I was using the release 39. I´ve tested it with r40 (r40Gamma3) and it worked better. I tested this with a bigger collection (84661 objects ) and it takes 16 seconds to answer either #size and #lastKnownSize. Do I have to set something to enable #lastKnownSize caching?
The new results are: "------------ 84661 objects - MagmaCollection>>size - fiirst evaluation" [ (magmaSession root at: #ThesaurusTerm) size ] timeToRun "answer about 247 milliseconds" "Note: magmaSession root at: #ThesaurusTerm answer a MagmaCollection"
"second evaluation" [ (magmaSession root at: #ThesaurusTerm) size ] timeToRun "answer about 0 milliseconds"
"MagmaCollectionReader>>size first evaluation" [ ((magmaSession root at: #ThesaurusTerm) read: #issnString) size ] timeToRun "answer about 16771 milliseconds" "second evaluation" [ ((magmaSession root at: #ThesaurusTerm) read: #issnString) size ] timeToRun "answer about 16870 milliseconds"
"MagmaCollectionReader>>size first evaluation" [ ((magmaSession root at: #ThesaurusTerm) read: #issnString) lastKnownSize] timeToRun "answer about 16573 milliseconds" "second evaluation" [ ((magmaSession root at: #ThesaurusTerm) read: #issnString) lastKnownSize] timeToRun "answer about 16529 milliseconds"
"------- 5500 objects - MagmaCollection>>size - fiirst evaluation" [ (magmaSession root at: #Serial) size ] timeToRun "answer about 698 milliseconds" "Note: magmaSession root at: #Serial answer a MagmaCollection"
"second evaluation" [ (magmaSession root at: #Serial) size ] timeToRun "answer about 0 milliseconds"
"MagmaCollectionReader>>size first evaluation" [ ((magmaSession root at: #Serial) read: #issnString) size ] timeToRun "answer about 1246 milliseconds" "second evaluation" [ ((magmaSession root at: #Serial) read: #issnString) size ] timeToRun "answer about 1246 milliseconds"
Juan M.
On 8/31/07, Chris Muller asqueaker@gmail.com wrote:
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
Hi Juan,
"MagmaCollectionReader>>size first evaluation" [ ((magmaSession root at: #ThesaurusTerm) read: #issnString) size ] timeToRun "answer about 16771 milliseconds"
It turns out #size is generic for any kind of query expression; but for up-to single-clause queries, it should check for that so it can be instantaneous as you point out.
I'll make a note of this and see about enhancing it for r41; but it might be a while before r41 is out (given that r40 isn't even out yet!).
#lastKnownSize; caches the size in the Reader instance, so subsequent calls are instantaneous even for complex queries.
- Chris
On 9/3/07, Burella Juan M. juan.burella@gmail.com wrote:
Chris thanks for your answers. Yes, I was using the release 39. I´ve tested it with r40 (r40Gamma3) and it worked better. I tested this with a bigger collection (84661 objects ) and it takes 16 seconds to answer either #size and #lastKnownSize. Do I have to set something to enable #lastKnownSize caching?
The new results are:
"------------ 84661 objects - MagmaCollection>>size - fiirst evaluation" [ (magmaSession root at: #ThesaurusTerm) size ] timeToRun "answer about 247 milliseconds" "Note: magmaSession root at: #ThesaurusTerm answer a MagmaCollection"
"second evaluation" [ (magmaSession root at: #ThesaurusTerm) size ] timeToRun "answer about 0 milliseconds"
"MagmaCollectionReader>>size first evaluation" [ ((magmaSession root at: #ThesaurusTerm) read: #issnString) size ] timeToRun "answer about 16771 milliseconds"
"second evaluation" [ ((magmaSession root at: #ThesaurusTerm) read: #issnString) size ] timeToRun "answer about 16870 milliseconds"
"MagmaCollectionReader>>size first evaluation" [ ((magmaSession root at: #ThesaurusTerm) read: #issnString) lastKnownSize] timeToRun "answer about 16573 milliseconds"
"second evaluation" [ ((magmaSession root at: #ThesaurusTerm) read: #issnString) lastKnownSize] timeToRun "answer about 16529 milliseconds"
"------- 5500 objects - MagmaCollection>>size - fiirst evaluation" [ (magmaSession root at: #Serial) size ] timeToRun "answer about 698 milliseconds" "Note: magmaSession root at: #Serial answer a MagmaCollection"
"second evaluation" [ (magmaSession root at: #Serial) size ] timeToRun "answer about 0 milliseconds"
"MagmaCollectionReader>>size first evaluation" [ ((magmaSession root at: #Serial) read: #issnString) size ] timeToRun "answer about 1246 milliseconds"
"second evaluation" [ ((magmaSession root at: #Serial) read: #issnString) size ] timeToRun "answer about 1246 milliseconds" Juan M.
On 8/31/07, Chris Muller <asqueaker@gmail.com > wrote:
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
Magma mailing list Magma@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/magma
magma@lists.squeakfoundation.org