difference between MaDictionary and MagmaDictionary

Chris Muller asqueaker at gmail.com
Wed Dec 15 02:46:27 UTC 2010


It doesn't matter how many or what type the objects are, just the
quality of their #hash.

On Tue, Dec 14, 2010 at 8:16 PM, Ching de la Serna <ching.dls at gmail.com> wrote:
> Hi Chris,
>
> Would a MagmaPreallocatedDictionary be suitable for a collection of say, 100
> million names and addresses?
>
> ching
>
> On Wed, Dec 15, 2010 at 10:00 AM, Chris Muller <asqueaker at gmail.com> wrote:
>>
>> MagmaDictionary is just a normal MagmaCollection with an index on
>> #hash (actually, #hash32 because its just a 32-bit index).  Please see
>> it in a hierarchy browser.  As a subclass of MagmaCollection, it
>> inherits its characteristics...  Which is actually unfortunate because
>> those characteristics of regular MagmaCollections have highest
>> throughput when answering _batches_ of rows.  But dictionary's are
>> accessed by #at:, just one object at a time.
>>
>> This is why I wrote MagmaPreallocatedDictionary.  It is based on a
>> MagmaArray.
>>
>> A MagmaArray is an auto-growing, but never shrinking, Array that can
>> be very large.  Please see the test cases whichh reference MagmaArray
>> for the actual semantics.
>>
>> MagmaArrays are as fast as possible, always just two disk seeks,
>> 6-bytes each, to get the location of the contents of any object.
>> That's why MagmaPreallocatedDictionary is much faster than a
>> MagmaCollection, which is based on a MaHashIndex file-structure for
>> supporting range-based querying.
>>
>>  - Chris
>>
>>
>>
>>
>> On Tue, Dec 14, 2010 at 4:57 PM, Esteban Lorenzano <estebanlm at gmail.com>
>> wrote:
>> > ok, and what about using MagmaDictionary? better? or the same?
>> >
>> > cheers,
>> > Esteban
>> >
>> > El 14/12/2010, a las 5:40p.m., Chris Muller escribió:
>> >
>> >>>> If I replace MaDictionary with Dictionary, I will be reading/writing
>> >>>> the
>> >>>> full dictionary each time I add an element to the dictionary...
>> >>>> isn't?
>> >>
>> >> Yes, that's true.  But a MaDictionary only saves you that if you have
>> >> a lot of collisions.
>> >>
>> >>> I think that you need replace MaDictionary with
>> >>> MagmaPreallocatedDictionary
>> >>> not with standard Dictionary.
>> >>
>> >> No, this is wrong, please see how MagmaPreallocatedDictionary works.
>> >> It is for very large dictionary's, Esteban is using a MaDictionary for
>> >> his root object, and my guess is it only has a few entries in it..
>> >>
>> >> - Chris
>> >
>> > _______________________________________________
>> > Magma mailing list
>> > Magma at lists.squeakfoundation.org
>> > http://lists.squeakfoundation.org/mailman/listinfo/magma
>> >
>> _______________________________________________
>> Magma mailing list
>> Magma at lists.squeakfoundation.org
>> http://lists.squeakfoundation.org/mailman/listinfo/magma
>
>
> _______________________________________________
> Magma mailing list
> Magma at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/magma
>
>


More information about the Magma mailing list