Newsgroups: comp.lang.dylan,comp.lang.misc,comp.lang.lisp,comp.object,comp.arch
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!oitnews.harvard.edu!purdue!lerc.nasa.gov!magnus.acs.ohio-state.edu!math.ohio-state.edu!howland.reston.ans.net!ix.netcom.com!netcom.com!NewsWatcher!user
From: hbaker@netcom.com (Henry Baker)
Subject: Re: allocator and GC locality (was Re: cost of malloc)
Message-ID: <hbaker-0908950821150001@192.0.2.1>
Sender: hbaker@netcom21.netcom.com
Organization: nil organization
References: <9507261647.AA14556@aruba.apple.com> <3v8g7l$cge@jive.cs.utexas.edu> <3vac07$ptf@info.epfl.ch> <3vb382$dtr@jive.cs.utexas.edu> <3vbl70$bht@fido.asd.sgi.com> <hbaker-3107951026250001@192.0.2.1> <justin-0108951458440001@158.234.26.212> <hbake <jyuynr@bmtech.demon.co.uk> <hbaker-0208950816000001@192.0.2.1> <jyvgwh@bmtech.demon.co.uk> <3vr85r$758@fido.asd.sgi.com> <KANZE.95Aug9150054@slsvhdt.lts.sel.alcatel.de>
Date: Wed, 9 Aug 1995 16:21:15 GMT
Lines: 30
Xref: glinda.oz.cs.cmu.edu comp.lang.dylan:5022 comp.lang.misc:22584 comp.lang.lisp:18622 comp.object:36568 comp.arch:60251

In article <KANZE.95Aug9150054@slsvhdt.lts.sel.alcatel.de>,
kanze@lts.sel.alcatel.de (James Kanze US/ESC 60/3/141 #40763) wrote:

> Interestingly enough, there is a legal (and safe) way of implementing
> this same idiom in C++.  It's so ugly, though, that I'm not going to
> post it.  (I know, if you were worried about ugliness, you wouldn't be
> using C++ anyway:-).)

Go ahead & post it!  Hit us with your ugly stick!  We're adults, and
we've turned off the V-chip...

> |>   This way, both the length and then data are allocated together in
the heap. And
> |> you haven't limited the max length artifically. (I suspect most BASIC
systems do
> |> this.)
> 
> I once ran benchmarks (with a very simple program, so probably not
> indicative of anythinkg) of three reference counted implementations of
> C++ strings: the classical one, the classical one with operator new
> overloaded for the fixed length header class, and one using the above
> ugly hack (and so only one allocation per string).  Under Solaris,
> using the standard system malloc (called directly by new), there was
> no significant difference in runtime.

We may be interested in these results after we've seen the program.

-- 
www/ftp directory:
ftp://ftp.netcom.com/pub/hb/hbaker/home.html
