Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!mcsun!unido!sbsvax!cs.uni-sb.de!hubert From: hubert@cs.uni-sb.de (Hubert Baumeister) Newsgroups: comp.lang.smalltalk Subject: Re: Smalltalk dictionary implementation Message-ID: <11517@sbsvax.cs.uni-sb.de> Date: 19 Jun 91 09:24:39 GMT References: <1991Jun19.154629.10217@phillip.edu.au> Sender: news@sbsvax.cs.uni-sb.de Organization: Max-Planck-Institut f"ur Informatik Lines: 27 In article <1991Jun19.154629.10217@phillip.edu.au>, x01233@phillip.edu.au writes: |> |> I am curious as to how Smalltalk implements dictionaries. From an examination |> of the code it seems that an insertion into a full dictionary results in the |> entire dictionary being copied (and increased in size) with the new item being |> inserted as the last act. |> |> Is this right, or have I been staring at the screen for too long? That is right. |> As well is there any way to specify an initial size for a dictionary |> (a variant on the 'new' message)? Yes. Try Dictionary new: size. This will create a dictionary which is capable of holding about size elements without growing. Hubert -- Hubert Baumeister Max-Planck-Institut f"ur Informatik Im Stadtwald 6600 Saarbr"ucken Telefon: (x49-681)302-5432 e-mail: hubert@cs.uni-sb.de