From: Clint Hyde
Subject: RE: allocator and GC locality (was Re: cost of malloc)
Date:
Message-ID: <40anj5$rra@info-server.bbn.com>
In article <·······················@192.0.2.1> ······@netcom.com (Henry Baker) writes:
--> I would contend that the vast majority of strings are not only fixed
--> length, but _constant_, and since there is no need to grow the string,
I'd disagree with this. In Lisp code, this is perhaps true, but in C, I
doubt it. Lisp lets you casually produce a new string, either via
CONCATENATE or FORMAT NIL or WITH-OUTPUT-TO-STRING and it GCs the old
ones for you. (In fact, it's harder to do otherwise. how would you tell
READ to reuse an input buffer that you already had hold of?)
C doesn't make this anywhere near as easy, so I think you tend to reuse
already-allocated strings A LOT. at least I do...and it could be argued
that I should do things a little differently, but still, I think you
tend to reuse strings in C, and you don't in Lisp.
-- clint
From: Erik Naggum
Subject: Re: allocator and GC locality (was Re: cost of malloc)
Date:
Message-ID: <19950809T172513Z@naggum.no>
[Clint Hyde]
| I'd disagree with this. In Lisp code, this is perhaps true, but in C, I
| doubt it. Lisp lets you casually produce a new string, either via
| CONCATENATE or FORMAT NIL or WITH-OUTPUT-TO-STRING and it GCs the old
| ones for you. (In fact, it's harder to do otherwise. how would you tell
| READ to reuse an input buffer that you already had hold of?)
`read-from-string' actually takes two keyword arguments `start' and `end'
which allows just that.
#<Erik 3016977913>
--
fact of the day:
the Norwegian sales tax is 23%