Faster dictionaries?

sig siguctua at gmail.com
Fri Jul 20 10:35:20 UTC 2007


On 20/07/07, stephane ducasse <stephane.ducasse at free.fr> wrote:
> >> sig's work is essentially same as HashTable...
> >>
> >> Except some details:
> >> HashTable has lot of message indirections to ease subclassing (Weak,
> >> Identity...)
> >> HashTable stores hash code instead of re-computing (memory/speed
> >> compromise)
> >> HashTable optimize link list enumeration with [...
> >> (item := item next) isNil] whileFalse loop rather than using
> >> recursive
> >> message send
> >>
> >
> > Interesting, why its not included to kernel classes?
>
> it would be good to have a nice package with the different
> implementation.

you can find it here:
http://bugs.squeak.org/view.php?id=6569

Want me to put it in squeaksource?

> I think that speeding up Dictionary would also have an impact on the
> overall
> performance of squeak (to be verified). Now we never got the energy
> to push that.
> But if someone want to have a look this would be great.
>

SpaceTally new spaceForInstancesOf: Association withInstanceCount: 1
returns 12

SpaceTally new spaceForInstancesOf: BAssociation withInstanceCount: 1
returns 20

Now, for dictionary with 100 items:
Dictionary:

412 bytes for array ivar. + 100 * 12 for associations
+ 16 bytes for Dictionary instance.
= 1628 bytes

BDictionary:

412 bytes for array ivar. + 100 * 20 for associations
+ 16 bytes for Dictionary instance.
= 2428 bytes

2428 / 1628  ~ 1.5

And regarding speed, there are still some things which can be
fine-tuned to get more performance.

> Stref
>
>
>
>



More information about the Squeak-dev mailing list