Newsgroups: comp.lang.smalltalk
Path: cantaloupe.srv.cs.cmu.edu!bb3.andrew.cmu.edu!newsfeed.pitt.edu!godot.cc.duq.edu!newsgate.duke.edu!news.mathworks.com!newsfeed.internetmci.com!psgrain!qiclab.scn.rain.com!gemstone.com!servio!servio!aland
From: aland@servio.slc.com (Alan Darlington)
Subject: Re: [Q] OrderedCollections
Message-ID: <1996Jul22.194829.29707@gemstone.com>
Sender: news@gemstone.com (USENET News)
Nntp-Posting-Host: servio
Organization: GemStone Systems, Inc., Beaverton OR, USA
References: <31EA4C56.3147@mcs.dundee.ac.uk> <31EAB6F5.1BCD@volpe4.dot.gov> <31ECA171.21A1@wizardpost.dundee.ncr.com>
Date: Mon, 22 Jul 1996 19:48:29 GMT
Lines: 47

tmochan@wizardpost.dundee.ncr.com writes:
> Alan L. Lovejoy wrote:
> > 
> > Tony Mochan wrote:
> 
> [snip]
> 
> > > Questions.
> > > ~~~~~~~~~~
> > > 1.  The OrderedCollection grows as needed, but does it shrink?
> > 
> > Not automatically.
> > 
> > > 2.  If not ... does this waste resources?
> > 
> > That depends.
> 
> On what?

Not much really.  Each unused pointer slot takes about 10 to 12
bytes (I don't work much at the interpreter level, and it may
also vary from vendor to vendor).  So with 100 unused entries,
you are wasting about 1KB.  Not much, but if you have enough
collections, these add up!

> 
> > > 3.  If yes (to Q2) ... how do I shrink it manually?
> > 
> >         "printQueue trim" will get rid of the unused space
> 
> This doesn't work for me ... "trim" not understood

#trim is a VW-specific message.  I looked at VA and could not
find any equivalent messages.

However, either of the following will probably work for you,
regardless of which flavor of Smalltalk you use:

    list := list copy.

    list := list asArray asOrderedCollection.

The first is cheaper and faster.

  Hope this helps,
  Alan
    (standard disclaimer)
